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

Gene Smith gds at chartertn.net
Sat Jan 21 02:39:22 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 of arm-none-eabi-g++ 
with the same result. I haven't tried the latest version that  was just 
recently released. 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 thing (static member in its own 
section and non-static member in default section) only without using 
templates. It builds with no error with the various gnu tool chains 
including CS.

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 another proprietary tool chain (ghs) but fails with CS-lite and 
other gcc versions with this "section type conflict" error.

-gene


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


More information about the arm-gnu mailing list