[llvm-commits] [llvm] r167356 - /llvm/trunk/include/llvm/Support/IntegersSubset.h

Duncan Sands baldrick at free.fr
Mon Nov 12 01:07:55 PST 2012


Hi Rafael,

On 12/11/12 01:30, Rafael EspĂ­ndola wrote:
> Hi Duncan,
>
> I am trying to reproduce this to see if the root problem is a gcc or
> clang bug, but I cannot get a failure. What I have done in checkout
> 167354 and run
>
> $ cmake ../llvm/ -DCMAKE_BUILD_TYPE=Release  -G Ninja
> $ ninja unittests/Support/Release/SupportTests
> $ valgrind ./unittests/Support/Release/SupportTests
>
> What kind of build and which architecture are you using?

this is Ubuntu 12.10 (the most recent) with the system gcc (4.7.2-2ubuntu1)
on x86_64-linux-gnu (intel core i7).

cmake -G Ninja ../llvm/ -DCMAKE_INCLUDE_PATH=/usr/include/x86_64-linux-gnu/ 
-DCMAKE_INSTALL_PREFIX=$HOME 
-DLLVM_BINUTILS_INCDIR=/home/duncan/Binutils/src/include/ 
-DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_ASSERTIONS=true -DLLVM_ENABLE_FFI=true 
-DLLVM_ENABLE_THREADS=true

Ciao, Duncan.

>
> On 3 November 2012 10:04, Duncan Sands <baldrick at free.fr> wrote:
>> Author: baldrick
>> Date: Sat Nov  3 09:04:04 2012
>> New Revision: 167356
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=167356&view=rev
>> Log:
>> Fix the IntegersSubsetTest unit test when compiled with gcc-4.7.  The issue here
>> is that the unit test doesn't have IntTy equal to APInt, instead it uses a class
>> derived from APInt.  When, as in these lines, an IntTy& reference is returned
>> but is assigned to an APInt&, the compiler destroys the temporary the IntTy& was
>> referring to, leaving the APInt& referring to garbage.  This causes the unittest
>> to fail systematically on my machine; it can also be caught by running the test
>> under valgrind.
>>
>> Modified:
>>      llvm/trunk/include/llvm/Support/IntegersSubset.h
>>
>> Modified: llvm/trunk/include/llvm/Support/IntegersSubset.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IntegersSubset.h?rev=167356&r1=167355&r2=167356&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Support/IntegersSubset.h (original)
>> +++ llvm/trunk/include/llvm/Support/IntegersSubset.h Sat Nov  3 09:04:04 2012
>> @@ -411,8 +411,8 @@
>>     unsigned getSize() const {
>>       APInt sz(((const APInt&)getItem(0).getLow()).getBitWidth(), 0);
>>       for (unsigned i = 0, e = getNumItems(); i != e; ++i) {
>> -      const APInt &Low = getItem(i).getLow();
>> -      const APInt &High = getItem(i).getHigh();
>> +      const APInt Low = getItem(i).getLow();
>> +      const APInt High = getItem(i).getHigh();
>>         APInt S = High - Low + 1;
>>         sz += S;
>>       }
>> @@ -426,8 +426,8 @@
>>     APInt getSingleValue(unsigned idx) const {
>>       APInt sz(((const APInt&)getItem(0).getLow()).getBitWidth(), 0);
>>       for (unsigned i = 0, e = getNumItems(); i != e; ++i) {
>> -      const APInt &Low = getItem(i).getLow();
>> -      const APInt &High = getItem(i).getHigh();
>> +      const APInt Low = getItem(i).getLow();
>> +      const APInt High = getItem(i).getHigh();
>>         APInt S = High - Low + 1;
>>         APInt oldSz = sz;
>>         sz += S;
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list