[LLVMbugs] [Bug 21647] New: While the code compiles with g++ with clang it generates a bug

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Nov 23 02:20:08 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21647

            Bug ID: 21647
           Summary: While the code compiles with g++ with clang it
                    generates a bug
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gkourtis at freemail.gr
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13389
  --> http://llvm.org/bugs/attachment.cgi?id=13389&action=edit
The compiler hangs

/bin/sh -c 'make -j4 -e -f  Makefile'
----------Building project:[ napl20 - mx32clang ]----------
make[1]: Entering directory '/home/gk/.codelite/workspace01/napl20'
/usr/bin/clang++   -c  "/home/gk/Dropbox/workspace01/napl20/main.cpp" -mx32
-std=c++14 -O0 -g -funsigned-char -fpermissive -Wno-logical-op-parentheses   -o
./mx32/main.cpp.o -I. -I/usr/include/x86_64-linux-gnu/c++/4.9/x32
-I/usr/include/x86_64-linux-gnu
fatal error: error in backend: Cannot select: 0x4854048: ch = brind
0x4853a88:1, 0x4853a88 [ORD=1] [ID=10]
  0x4853a88: i32,ch = load 0x4853980:1, 0x4835350, 0x484d578<LD4[JumpTable]>
[ORD=1] [ID=9]
    0x4835350: i32 = add 0x4833a68, 0x4837270 [ORD=1] [ID=8]
      0x4833a68: i32 = shl 0x4853980, 0x48459b0 [ORD=1] [ID=7]
        0x4853980: i32,ch = CopyFromReg 0x4582490, 0x4842a08 [ORD=1] [ID=5]
          0x4842a08: i32 = Register %vreg41 [ID=1]
        0x48459b0: i8 = Constant<2> [ID=4]
      0x4837270: i32 = X86ISD::Wrapper 0x4805d00 [ID=6]
        0x4805d00: i32 = TargetJumpTable<0> [ID=3]
    0x484d578: i32 = undef [ID=2]
In function: _Z6newobjIiE3objS0_PKT_jjjb
clang: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
Ubuntu clang version 3.5.0-4ubuntu2 (tags/RELEASE_350/final) (based on LLVM
3.5.0)
Target: x86_64-pc-linux-gnux32
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://bugs.debian.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/main-7567a4.cpp
clang: note: diagnostic msg: /tmp/main-7567a4.sh
clang: note: diagnostic msg:

********************
napl20.mk:91: recipe for target 'mx32/main.cpp.o' failed
make[1]: *** [mx32/main.cpp.o] Error 70
make[1]: Leaving directory '/home/gk/.codelite/workspace01/napl20'
Makefile:4: recipe for target 'All' failed
make: *** [All] Error 2
1 errors, 0 warnings

The code of the function is:

template<typename T> obj newobj(
  obj Class,const T* pValues=nullptr,uWord size=1,uWord elements=1,uWord
exL=0,bool isReference=false
)
{
// the function constructs an object of type "Class" that containes elements of
type T.
// The number of elements is elements. The execution Level is given defaults to
passive=0
    tobj o=reserveVect();
    o.Class(Class);
    o.executionLevel(exL);
    o.readOnly(false);o.reference(isReference);o.keepAlive(false);

    switch(Class.w) {
        case _classAggregate:
        case _classString:{
            if(size<=std::numeric_limits<suWord>::max()){ 
                hAggregateBase_<T,suWord>
*p=o.allocateBody<hAggregateBase_<T,suWord>,T>(size);
                p->size=size;
                if(pValues) memcpy(p+1,pValues,sizeof(T)*elements);
                p->n=elements;break;
            }else{
                hAggregateBase_<T,uWord>
*p=o.allocateBody<hAggregateBase_<T,uWord>,T>(size);
                p->size=size;
                if(pValues) memcpy(p+1,pValues,sizeof(T)*elements);
                p->n=elements;break;
            }        
        }
        classVarAggregate(_classVar,o,hVarBase<T>,) // it is correct that the
last arg is missing
        classBasicData(_classFloat,o,hFixBase<T>,T)
        classBasicData(_classDouble,o,hFixBase<T>,T)
        classBasicData(_classInt,o,hFixBase<T>,T)
        case _classUndefined:
            break;
        case _classPrimitive:
            o.executeP((primitiveP)pValues);
            break;// in that case the elements parameter is ignored.
        default:
            assert0(false,"Problem in newobj");
    }
    gctest();
    return o;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141123/41560ae6/attachment.html>


More information about the llvm-bugs mailing list