<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - While the code compiles with g++ with clang it generates a bug"
   href="http://llvm.org/bugs/show_bug.cgi?id=21647">21647</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>While the code compiles with g++ with clang it generates a bug
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>gkourtis@freemail.gr
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13389" name="attach_13389" title="The compiler hangs">attachment 13389</a> <a href="attachment.cgi?id=13389&action=edit" title="The compiler hangs">[details]</a></span>
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
<a href="http://bugs.debian.org/">http://bugs.debian.org/</a> 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;
}</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>