Qt5 build error shared array can't have dynamic allocation

Qt5 build error shared array can't have dynamic allocation

Hello

I'm trying to build Qt5 and have the following error.

../../include/QtQml/5.2.0/QtQml/private/../../../../../src/qml/jsruntime/qv4object_p.h(208): internal error: assertion failed at: "shared/cfe/edgcpfe/lower_init.c", line 3351

              PropertyAttributes *newAttrs = new PropertyAttributes[arrayOffset + arrayAlloc];
                                           ^

I've filed a bug report QTBUG-36577

Appears to be a dynamic allocation issue according to this.
https://devtalk.nvidia.com/default/topic/369934/cuda-programming-and-performance/compiler-error/

here is the section of qv4object_p.h not sure how to rework it to avoid the problem.

    void getArrayHeadRoom() {
        assert(!sparseArray && !arrayOffset);
        arrayOffset = qMax(arrayDataLen >> 2, (uint)16);
        Property *newArray = new Property[arrayOffset + arrayAlloc];
        memcpy(newArray + arrayOffset, arrayData, arrayDataLen*sizeof(Property));
        delete [] arrayData;
        arrayData = newArray + arrayOffset;
        if (arrayAttributes) {
            PropertyAttributes *newAttrs = new PropertyAttributes[arrayOffset + arrayAlloc];
            memcpy(newAttrs + arrayOffset, arrayAttributes, arrayDataLen*sizeof(PropertyAttributes));
            delete [] arrayAttributes;
            arrayAttributes = newAttrs + arrayOffset;
        }
    }

here is the full icpc call.

gmake[3]: Entering directory `/usr/local/qt-everywhere-opensource-src-5.2.0/qtdeclarative/src/qml'
icpc -c -O0 -g -fvisibility=hidden -fvisibility-inlines-hidden -std=c++0x -fno-exceptions -w1 -Wall -Wcheck -wd1572,873,2259,2261 -D_REENTRANT -D_REENTRANT -D_REENTRANT -fPIC -fno-jump-tables -DQT_NO_URL_CAST_FROM_STRING -DQT_NO_INTEGER_EVENT_COORDINATES -DQT_BUILD_QML_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DWTF_EXPORT_PRIVATE= -DJS_EXPORT_PRIVATE= -DWTFReportAssertionFailure=qmlWTFReportAssertionFailure -DWTFReportBacktrace=qmlWTFReportBacktrace -DWTFInvokeCrashHook=qmlWTFInvokeCrashHook -DENABLE_LLINT=0 -DENABLE_DFG_JIT=0 -DENABLE_DFG_JIT_UTILITY_METHODS=1 -DENABLE_JIT_CONSTANT_BLINDING=0 -DBUILDING_QT__ -DWTF_USE_UDIS86=0 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NETWORK_LIB -DQT_CORE_LIB -I/usr/local/qt-everywhere-opensource-src-5.2.0/qtbase/mkspecs/linux-icc-64 -I. -I../../include -I../../include/QtQml -I../../include/QtQml/5.2.0 -I../../include/QtQml/5.2.0/QtQml -I../3rdparty/masm/jit -I../3rdparty/masm/assembler -I../3rdparty/masm/runtime -I../3rdparty/masm/wtf -I../3rdparty/masm/stubs -I../3rdparty/masm/stubs/wtf -I../3rdparty/masm -I../3rdparty/masm/disassembler -I../3rdparty/masm/disassembler/udis86 -Icompiler -I. -Ijsruntime -I. -I../3rdparty/double-conversion -Ianimations -I/usr/local/qt-everywhere-opensource-src-5.2.0/qtbase/include -I/usr/local/qt-everywhere-opensource-src-5.2.0/qtbase/include/QtNetwork -I/usr/local/qt-everywhere-opensource-src-5.2.0/qtbase/include/QtCore/5.2.0 -I/usr/local/qt-everywhere-opensource-src-5.2.0/qtbase/include/QtCore/5.2.0/QtCore -I/usr/local/qt-everywhere-opensource-src-5.2.0/qtbase/include/QtCore -I.moc -o .obj/moc_qqmllocale_p.o .moc/moc_qqmllocale_p.cpp
../../include/QtQml/5.2.0/QtQml/private/../../../../../src/qml/jsruntime/qv4object_p.h(208): internal error: assertion failed at: "shared/cfe/edgcpfe/lower_init.c", line 3351

              PropertyAttributes *newAttrs = new PropertyAttributes[arrayOffset + arrayAlloc];
                                           ^

compilation aborted for .moc/moc_qqmllocale_p.cpp (code 4)

7 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

Hello,

Please provide the following:

(1) version of the compiler that you are using (do an icpc -V)

(2) Please attach a preprocessed file (add the -E or -P option to your command line) which shows the error.

thanks,

Judy

Hi Judy

I apologize for not including the compiler version with my query.  I did it the Qt bug report but slipped up here.

icpc -V
Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.1.106 Build 20131008

uname -a
Linux  3.11.6-4-desktop #1 SMP PREEMPT Wed Oct 30 18:04:56 UTC 2013 (e6d4a27) x86_64 x86_64 x86_64 GNU/Linux

Attached -E -dM output moc_qqmllocale_p.txt

Thank You for looking at this issue

Rich

Anexos: 

AnexoTamanho
Download moc_qqmllocale_p.txt170.16 KB

 

Thanks Rich,

What I was looking for was the preprocessed file (the source file after all the headers have been included and macros expanded) not a list of the predefined macros. So please just add -E (without the -dM) to the compilation line and then send me the output. Then I should be able to reproduce the internal error and start working on it.

 

Example:

icpc -E (all the other command line options) bug.cpp >preprocessedbug.cpp

thanks again!

Judy

 

Hi Judy

Find attached -E output moc_qqmllocale_p_1.txt

Thank You

Rich

Anexos: 

AnexoTamanho
Download moc_qqmllocale_p_1_0.txt2.7 MB
Best Reply

 

Hi Rich,

Thanks for the test case. I have reproduced the assertion in our current compiler and entered a bug in our internal database as DPD200253124.

Below is a small reproducer of the problem. It seems to be triggered by your use of the -fno-exceptions switch ... is that switch necessary or are you just trying to reduce the compilation time or size of the executable?

Not using the -fnoexceptions switch seems like the only feasible workaround I can think of...

Sorry for the inconvenience. We will get this fixed ASAP.

Judy

sptxl8-313> cat bug.cpp
class QObject;

struct QMetaObject
{
    struct {
        typedef void (*StaticMetacallFunction)(QObject *);
        StaticMetacallFunction static_metacall;
    } d;
};

struct PropertyAttributes
{
    PropertyAttributes();
};

extern void __assert_fail (const char *);

struct Object
{
    void getArrayHeadRoom() {
       int i = 5, j = 16;
       ((!i) ?  static_cast<void> (0) : __assert_fail(__PRETTY_FUNCTION__));
       new PropertyAttributes[j + i];
    }

};

struct QQmlLocale
{
    static const QMetaObject staticMetaObject;
};

const QMetaObject QQmlLocale::staticMetaObject = { { 0 } };

sptxl8-314> icpc -c -fno-exceptions -std=c++11 bug.cpp
bug.cpp(23): internal error: assertion failed at: "shared/cfe/edgcpfe/lower_init.c", line 3338

         new PropertyAttributes[j + i];
         ^

compilation aborted for bug.cpp (code 4)
sptxl8-315>

 

Hi Judy

Thank you for addressing this issue so quickly.

Removing the -fno-exceptions switch allowed the compilation
to continue to the next unrelated error.

I've updated the QT bug report to reflect your solution.

Thank You Again
Rich

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!