[arm-gnu] Static template member in assigned section -- section type conflict

Gene Smith gds at chartertn.net
Sat Jan 21 19:58:42 UTC 2012


Attached are two test cases that illustrate an error I am seeing with 
templates. When bad.cpp is compiled it shows this error:

t.cpp:31:59: error: innerInst causes a section type conflict

By editing bad.cpp this error can be removed with several changes:

1. Change the #if 1 to #if 0 so that the static template member "b" is 
not assigned to a special section but to a default section (probably .bss).

2. Or leave #if 1 in place and change the section name on the static "b" 
variable definition to something else, like ".myysect" (different than 
the section assigned to the static variable in main()).

3. Or don't access the "b" variable in main().

None of these are really acceptable but the bad.cpp then compiles 
without a fatal error.

I have tried this with several CS-lite versions (including the latest) 
of arm-none-eabi-g++ with the same result. I have also tried other gcc 
version such as cygwin and linux that are 4.5.x and see the same error.

The file good.cpp illustrates the same concept (static member in its own 
section and non-static member in default section) but without using 
templates. It builds with no error with the various gnu tool chains 
including CS-lite.

I am not sure if the error is legitimate or actually a gcc bug.

Bad.cpp is a simplification of a larger program that reportedly builds 
OK with a proprietary tool chain (ghs) but fails with CS-lite and other 
gcc versions/variants with this "section type conflict" error.

Thanks,
-gene

P/S: The arm-gnu at codesourcery.com list seems to be inactive and not 
accepting posts since about 1/6 so I am bcc'ing the moderators. This is 
a re-post that was sent yesterday that has yet to appear in the Jan 2012 
archives.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: bad.cpp
Type: text/x-c++src
Size: 706 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/arm-gnu/attachments/20120121/cfe3283c/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: good.cpp
Type: text/x-c++src
Size: 313 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/arm-gnu/attachments/20120121/cfe3283c/attachment-0001.cpp>


More information about the arm-gnu mailing list