https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67688
Bug ID: 67688 Summary: [MinGW/Cygwin] Attributes selectany and section cannot be used together Product: gcc Version: 5.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: thiago at kde dot org Target Milestone: --- The following program: __declspec(selectany) __attribute__((section("foo"))) int i = 0; Fails to compile with: error: i causes a section type conflict The same program compiles with clang -target i386-mingw -fms-compatibility and produces the assembly: .section foo,"dw",discard,_i .globl _i # @i .align 4 _i: .long 0 # 0x0 The similar program: #pragma data_seg("foo") __declspec(selectany) __declspec(allocate("foo")) int i = 0; compiles without error with MSVC and produces assembly: PUBLIC i ; COMDAT i foo SEGMENT i DD 00H foo ENDS