NativeJIT/function.h error with GCC12

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all.

I need help for following error due to the new GCC12:

make[2]: Leaving directory '/builddir/build/BUILD/COPASI-Build-251/build'
*** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins.
Event                            | Plugins
PLUGIN_FINISH_UNIT               | annobin: Generate final annotations
PLUGIN_START_UNIT                | annobin: Generate global annotations
PLUGIN_ALL_PASSES_START | annobin: Generate per-function annotations PLUGIN_ALL_PASSES_END | annobin: Register per-function end symbols In file included from /builddir/build/BUILD/COPASI-Build-251/copasi/math/CJitCompiler.h:15, from /builddir/build/BUILD/COPASI-Build-251/copasi/math/CMathContainer.h:35, from /builddir/build/BUILD/COPASI-Build-251/copasi/function/CEvaluationNodeOperator.cpp:35: /usr/include/NativeJIT/Function.h: In constructor 'NativeJIT::Function<R, P1, P2, P3, P4>::Function(Allocators::IAllocator&, NativeJIT::FunctionBuffer&)': /usr/include/NativeJIT/Function.h:192:44: internal compiler error: in cp_parser_template_id, at cp/parser.cc:18367
  192 |         m_p1 = &this->template Parameter<P1>(slotAllocator);
      |                                            ^
Please submit a full bug report, with preprocessed source (by using -freport-bug).

Should be related to this GCC bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104235

Regards
--
---
Antonio Trande
Fedora Project
mailto: sagitter@xxxxxxxxxxxxxxxxx
GPG key: 0xCC1CFEF30920C8AE
GPG key server: https://keyserver1.pgp.com/
// The MIT License (MIT)

// Copyright (c) 2016, Microsoft

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


#pragma once

#include "NativeJIT/ExecutionPreconditionTest.h"
#include "NativeJIT/ExpressionNodeFactory.h"
#include "NativeJIT/TypePredicates.h"


namespace NativeJIT
{
    template <typename R>
    class FunctionBase : public ExpressionNodeFactory
    {
    public:
        FunctionBase(Allocators::IAllocator& allocator, FunctionBuffer& code);

        template <JccType JCC>
        void AddExecuteOnlyIfStatement(FlagExpressionNode<JCC>& condition,
                                       ImmediateNode<R>& otherwiseValue);

    private:
        Allocators::IAllocator& m_allocator;
    };


    template <typename R, typename P1 = void, typename P2 = void, typename P3 = void, typename P4 = void>
    class Function : public FunctionBase<R>
    {
    public:
        Function(Allocators::IAllocator& allocator, FunctionBuffer& code);

        ParameterNode<P1>& GetP1() const;
        ParameterNode<P2>& GetP2() const;
        ParameterNode<P3>& GetP3() const;
        ParameterNode<P4>& GetP4() const;

        typedef R (*FunctionType)(P1, P2, P3, P4);

        FunctionType Compile(Node<R>& expression);

        FunctionType GetEntryPoint() const;

    private:
        ParameterNode<P1>* m_p1;
        ParameterNode<P2>* m_p2;
        ParameterNode<P3>* m_p3;
        ParameterNode<P4>* m_p4;
    };


    template <typename R, typename P1, typename P2, typename P3>
    class Function<R, P1, P2, P3> : public FunctionBase<R>
    {
    public:
        Function(Allocators::IAllocator& allocator, FunctionBuffer& code);

        ParameterNode<P1>& GetP1() const;
        ParameterNode<P2>& GetP2() const;
        ParameterNode<P3>& GetP3() const;

        typedef R (*FunctionType)(P1, P2, P3);

        FunctionType Compile(Node<R>& expression);

        FunctionType GetEntryPoint() const;

    private:
        ParameterNode<P1>* m_p1;
        ParameterNode<P2>* m_p2;
        ParameterNode<P3>* m_p3;
    };


    template <typename R, typename P1, typename P2>
    class Function<R, P1, P2> : public FunctionBase<R>
    {
    public:
        Function(Allocators::IAllocator& allocator, FunctionBuffer& code);

        ParameterNode<P1>& GetP1() const;
        ParameterNode<P2>& GetP2() const;

        typedef R (*FunctionType)(P1, P2);

        FunctionType Compile(Node<R>& expression);

        FunctionType GetEntryPoint() const;

    private:
        ParameterNode<P1>* m_p1;
        ParameterNode<P2>* m_p2;
    };


    template <typename R, typename P1>
    class Function<R, P1> : public FunctionBase<R>
    {
    public:
        Function(Allocators::IAllocator& allocator, FunctionBuffer& code);

        ParameterNode<P1>& GetP1() const;

        typedef R (*FunctionType)(P1);

        FunctionType Compile(Node<R>& expression);

        FunctionType GetEntryPoint() const;

    private:
        ParameterNode<P1>* m_p1;
    };


    template <typename R>
    class Function<R> : public FunctionBase<R>
    {
    public:
        Function(Allocators::IAllocator& allocator, FunctionBuffer& code);

        typedef R (*FunctionType)();

        FunctionType Compile(Node<R>& expression);

        FunctionType GetEntryPoint() const;
    };


    //*************************************************************************
    //
    // FunctionBase<R> template definitions.
    //
    //*************************************************************************
    template <typename R>
    FunctionBase<R>::FunctionBase(Allocators::IAllocator& allocator,
                                  FunctionBuffer& code)
        : ExpressionNodeFactory(allocator, code),
          m_allocator(allocator)
    {
        static_assert(IsValidParameter<R>::c_value, "R is an invalid type.");
    }


    template <typename R>
    template <JccType JCC>
    void FunctionBase<R>::AddExecuteOnlyIfStatement(FlagExpressionNode<JCC>& condition,
                                                    ImmediateNode<R>& otherwiseValue)
    {
        auto & test = PlacementConstruct<ExecuteOnlyIfStatement<R, JCC>>(condition, otherwiseValue);

        AddExecutionPreconditionTest(test);
    }


    //*************************************************************************
    //
    // Function<R, P1, P2, P3, P4> template definitions.
    //
    //*************************************************************************
    template <typename R, typename P1, typename P2, typename P3, typename P4>
    Function<R, P1, P2, P3, P4>::Function(Allocators::IAllocator& allocator,
                                          FunctionBuffer& code)
        : FunctionBase<R>(allocator, code)
    {
        static_assert(IsValidParameter<P1>::c_value, "P1 is an invalid type.");
        static_assert(IsValidParameter<P2>::c_value, "P2 is an invalid type.");
        static_assert(IsValidParameter<P3>::c_value, "P3 is an invalid type.");
        static_assert(IsValidParameter<P4>::c_value, "P4 is an invalid type.");

        ParameterSlotAllocator slotAllocator;
        m_p1 = &this->template Parameter<P1>(slotAllocator);
        m_p2 = &this->template Parameter<P2>(slotAllocator);
        m_p3 = &this->template Parameter<P3>(slotAllocator);
        m_p4 = &this->template Parameter<P4>(slotAllocator);
    }


    template <typename R, typename P1, typename P2, typename P3, typename P4>
    ParameterNode<P1>& Function<R, P1, P2, P3, P4>::GetP1() const
    {
        return *m_p1;
    }


    template <typename R, typename P1, typename P2, typename P3, typename P4>
    ParameterNode<P2>& Function<R, P1, P2, P3, P4>::GetP2() const
    {
        return *m_p2;
    }


    template <typename R, typename P1, typename P2, typename P3, typename P4>
    ParameterNode<P3>& Function<R, P1, P2, P3, P4>::GetP3() const
    {
        return *m_p3;
    }


    template <typename R, typename P1, typename P2, typename P3, typename P4>
    ParameterNode<P4>& Function<R, P1, P2, P3, P4>::GetP4() const
    {
        return *m_p4;
    }


    template <typename R, typename P1, typename P2, typename P3, typename P4>
    typename Function<R, P1, P2, P3, P4>::FunctionType
    Function<R, P1, P2, P3, P4>::Compile(Node<R>& value)
    {
        this->template Return<R>(value);
        ExpressionTree::Compile();
        return GetEntryPoint();
    }


    template <typename R, typename P1, typename P2, typename P3, typename P4>
    typename Function<R, P1, P2, P3, P4>::FunctionType
    Function<R, P1, P2, P3, P4>::GetEntryPoint() const
    {
        return reinterpret_cast<FunctionType>(const_cast<void*>(this->GetUntypedEntryPoint()));
    }


    //*************************************************************************
    //
    // Function<R, P1, P2, P3> template definitions.
    //
    //*************************************************************************
    template <typename R, typename P1, typename P2, typename P3>
    Function<R, P1, P2, P3>::Function(Allocators::IAllocator& allocator,
                                      FunctionBuffer& code)
        : FunctionBase<R>(allocator, code)
    {
        static_assert(IsValidParameter<P1>::c_value, "P1 is an invalid type.");
        static_assert(IsValidParameter<P2>::c_value, "P2 is an invalid type.");
        static_assert(IsValidParameter<P3>::c_value, "P3 is an invalid type.");

        ParameterSlotAllocator slotAllocator;
        m_p1 = &this->template Parameter<P1>(slotAllocator);
        m_p2 = &this->template Parameter<P2>(slotAllocator);
        m_p3 = &this->template Parameter<P3>(slotAllocator);
    }


    template <typename R, typename P1, typename P2, typename P3>
    ParameterNode<P1>& Function<R, P1, P2, P3>::GetP1() const
    {
        return *m_p1;
    }


    template <typename R, typename P1, typename P2, typename P3>
    ParameterNode<P2>& Function<R, P1, P2, P3>::GetP2() const
    {
        return *m_p2;
    }


    template <typename R, typename P1, typename P2, typename P3>
    ParameterNode<P3>& Function<R, P1, P2, P3>::GetP3() const
    {
        return *m_p3;
    }


    template <typename R, typename P1, typename P2, typename P3>
    typename Function<R, P1, P2, P3>::FunctionType
    Function<R, P1, P2, P3>::Compile(Node<R>& value)
    {
        this->template Return<R>(value);
        ExpressionTree::Compile();
        return GetEntryPoint();
    }


    template <typename R, typename P1, typename P2, typename P3>
    typename Function<R, P1, P2, P3>::FunctionType
    Function<R, P1, P2, P3>::GetEntryPoint() const
    {
        return reinterpret_cast<FunctionType>(const_cast<void*>(this->GetUntypedEntryPoint()));
    }


    //*************************************************************************
    //
    // Function<R, P1, P2> template definitions.
    //
    //*************************************************************************
    template <typename R, typename P1, typename P2>
    Function<R, P1, P2>::Function(Allocators::IAllocator& allocator,
                                  FunctionBuffer& code)
        : FunctionBase<R>(allocator, code)
    {
        static_assert(IsValidParameter<P1>::c_value, "P1 is an invalid type.");
        static_assert(IsValidParameter<P2>::c_value, "P2 is an invalid type.");

        ParameterSlotAllocator slotAllocator;
        m_p1 = &this->template Parameter<P1>(slotAllocator);
        m_p2 = &this->template Parameter<P2>(slotAllocator);
    }


    template <typename R, typename P1, typename P2>
    ParameterNode<P1>& Function<R, P1, P2>::GetP1() const
    {
        return *m_p1;
    }


    template <typename R, typename P1, typename P2>
    ParameterNode<P2>& Function<R, P1, P2>::GetP2() const
    {
        return *m_p2;
    }


    template <typename R, typename P1, typename P2>
    typename Function<R, P1, P2>::FunctionType
    Function<R, P1, P2>::Compile(Node<R>& value)
    {
        this->template Return<R>(value);
        ExpressionTree::Compile();
        return GetEntryPoint();
    }


    template <typename R, typename P1, typename P2>
    typename Function<R, P1, P2>::FunctionType
    Function<R, P1, P2>::GetEntryPoint() const
    {
        return reinterpret_cast<FunctionType>(const_cast<void*>(this->GetUntypedEntryPoint()));
    }


    //*************************************************************************
    //
    // Function<R, P1> template definitions.
    //
    //*************************************************************************
    template <typename R, typename P1>
    Function<R, P1>::Function(Allocators::IAllocator& allocator,
                              FunctionBuffer& code)
        : FunctionBase<R>(allocator, code)
    {
        static_assert(IsValidParameter<P1>::c_value, "P1 is an invalid type.");

        ParameterSlotAllocator slotAllocator;
        m_p1 = &this->template Parameter<P1>(slotAllocator);
    }


    template <typename R, typename P1>
    ParameterNode<P1>& Function<R, P1>::GetP1() const
    {
        return *m_p1;
    }


    template <typename R, typename P1>
    typename Function<R, P1>::FunctionType
    Function<R, P1>::Compile(Node<R>& value)
    {
        this->template Return<R>(value);
        ExpressionTree::Compile();
        return GetEntryPoint();
    }


    template <typename R, typename P1>
    typename Function<R, P1>::FunctionType
    Function<R, P1>::GetEntryPoint() const
    {
        return reinterpret_cast<FunctionType>(const_cast<void*>(this->GetUntypedEntryPoint()));
    }


    //*************************************************************************
    //
    // Function<R> template definitions.
    //
    //*************************************************************************
    template <typename R>
    Function<R>::Function(Allocators::IAllocator& allocator,
                          FunctionBuffer& code)
        : FunctionBase<R>(allocator, code)
    {
    }


    template <typename R>
    typename Function<R>::FunctionType  Function<R>::Compile(Node<R>& value)
    {
        this->template Return<R>(value);
        ExpressionTree::Compile();
        return GetEntryPoint();
    }


    template <typename R>
    typename Function<R>::FunctionType Function<R>::GetEntryPoint() const
    {
        return reinterpret_cast<FunctionType>(const_cast<void*>(this->GetUntypedEntryPoint()));
    }
}

Attachment: OpenPGP_0xCC1CFEF30920C8AE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux