[llvm-dev] 3.9 regression with legacy static assert macros (bad type resolution)

Jeremy Huddleston Sequoia via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 22 21:36:23 PST 2016


3.9.0 and current release_39 (r90413) have issues with older static assertion macros like this one from an older libunwind:

#define COMPILE_TIME_ASSERT( expr )    \
               extern int compile_time_assert_failed[ ( expr ) ? 1 : -1 ] __attribute__( ( unused ) );

I notice that the issue is fixed on current trunk.  Does anyone know what revision introduced the fix?  Can we get it cherry-picked into release_39?  I know 3.9.1 final was just tagged, but having it on the branch will make it easier for distributions to find since this is a fairly common pattern, and of course it would be good to fix this regression in 3.9.2 if there is one.

--Jeremy


---

~ $ clang++-mp-3.9 -Wno-invalid-offsetof -c macho_relocatable_file.cpp 
In file included from src/ld/parsers/macho_relocatable_file.cpp:37:
src/ld/parsers/libunwind/DwarfInstructions.hpp:920:13: error: redeclaration of 'compile_time_assert_failed' with a different type: 'int [((int)CFI_Parser<A>::kMaxRegisterNumber > (int)DW_X86_64_RET_ADDR) ? 1 : -1]' vs
     'int [1]'
extern int compile_time_assert_failed[ ( (int)CFI_Parser<A>::kMaxRegisterNumber > (int)DW_X86_64_RET_ADDR ) ? 1 : -1 ] __attribute__( ( unused ) );;
           ^
src/ld/parsers/libunwind/Registers.hpp:548:13: note: previous declaration is here
extern int compile_time_assert_failed[ ( sizeof(Registers_ppc) < sizeof(unw_context_t) ) ? 1 : -1 ] __attribute__( ( unused ) );;
           ^
In file included from src/ld/parsers/macho_relocatable_file.cpp:37:
src/ld/parsers/libunwind/DwarfInstructions.hpp:1311:13: error: redeclaration of 'compile_time_assert_failed' with a different type: 'int [((int)CFI_Parser<A>::kMaxRegisterNumber > (int)DW_X86_RET_ADDR) ? 1 : -1]' vs
     'int [1]'
extern int compile_time_assert_failed[ ( (int)CFI_Parser<A>::kMaxRegisterNumber > (int)DW_X86_RET_ADDR ) ? 1 : -1 ] __attribute__( ( unused ) );;
           ^
src/ld/parsers/libunwind/Registers.hpp:548:13: note: previous declaration is here
extern int compile_time_assert_failed[ ( sizeof(Registers_ppc) < sizeof(unw_context_t) ) ? 1 : -1 ] __attribute__( ( unused ) );;
           ^
In file included from src/ld/parsers/macho_relocatable_file.cpp:37:
src/ld/parsers/libunwind/DwarfInstructions.hpp:1677:13: error: redeclaration of 'compile_time_assert_failed' with a different type: 'int [((int)CFI_Parser<A>::kMaxRegisterNumber > (int)UNW_PPC_SPEFSCR) ? 1 : -1]' vs
     'int [1]'
extern int compile_time_assert_failed[ ( (int)CFI_Parser<A>::kMaxRegisterNumber > (int)UNW_PPC_SPEFSCR ) ? 1 : -1 ] __attribute__( ( unused ) );;
           ^
src/ld/parsers/libunwind/Registers.hpp:548:13: note: previous declaration is here
extern int compile_time_assert_failed[ ( sizeof(Registers_ppc) < sizeof(unw_context_t) ) ? 1 : -1 ] __attribute__( ( unused ) );;
           ^
3 errors generated.

~ $ clang++-mp-3.8 -Wno-invalid-offsetof -c macho_relocatable_file.cpp 

~ $ clang++-mp-devel -Wno-invalid-offsetof -c macho_relocatable_file.cpp 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161222/228c5dd2/attachment.bin>


More information about the llvm-dev mailing list