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

Frédéric Riss via llvm-dev llvm-dev at lists.llvm.org
Fri Dec 23 11:17:50 PST 2016


> On Dec 22, 2016, at 9:36 PM, Jeremy Huddleston Sequoia via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> 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

I think this was fixed in r280330 (in clang).

Fred

> 
> --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 
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list