[PATCH] Adjust error message for initialized variable in .bss

Eric Botcazou botcazou@adacore.com
Fri Nov 22 11:52:19 GMT 2024


Hi,

if you compile the following Ada package:

package Bss1 is

  I : Integer := 0 with Linker_Section => ".bss";

end Bss1;

you get the error:

bss1.ads:3:3: error: only zero initializers are allowed in section '.bss'

which is quite paradoxical.  The reason is that the default setting in Ada is 
-fno-zero-initialized-in-bss instead of -fzero-initialized-in-bss.

Tested on x86-64/Linux, OK for the mainline?


2024-11-22  Eric Botcazou  <ebotcazou@adacore.com>

	* doc/invoke.texi (-fno-zero-initialized-in-bss): Adjust for Ada.
	* arasm.cc (get_variable_section): Adjust the error message for an
	initialized variable in .bss to -fno-zero-initialized-in-bss.


2024-11-22  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/specs/bss1.ads: New test.

-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 1299 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20241122/2b35bb56/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bss1.ads
Type: text/x-adasrc
Size: 112 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20241122/2b35bb56/attachment-0003.bin>


More information about the Gcc-patches mailing list