[Bug c/81368] New: GCC reports bad option if -fdata-sections/-ffunction-sections is specified through #pragma or function attribute
sebastian.schrader at ossmail dot de
gcc-bugzilla@gcc.gnu.org
Sun Jul 9 21:49:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81368
Bug ID: 81368
Summary: GCC reports bad option if
-fdata-sections/-ffunction-sections is specified
through #pragma or function attribute
Product: gcc
Version: 7.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: sebastian.schrader at ossmail dot de
Target Milestone: ---
GCC 7.1.1 reports a bad option if -fdata-sections or -ffunction-section is
specified through the #pragma GCC optimize directive or the optimize function
attribute.
Earlier versions of GCC, such as 5.4.0 don't report a bad option and also act
upon it (verified with objdump -x).
Example with #pragma:
#pragma GCC optimize("-ffunction-sections")
int f(int x)
{
return x;
}
% gcc -o pragma.o -c pragma.c
pragma.c:1:9: warning: bad option ‘-ffunction-sections’ to pragma ‘optimize’
[-Wpragmas]
#pragma GCC optimize("-ffunction-sections")
^~~
pragma.c:4:1: warning: bad option ‘-ffunction-sections’ to attribute ‘optimize’
[-Wattributes]
{
^
Example with attribute:
__attribute__((optimize("-fdata-sections")))
int g(int x)
{
return x;
}
% gcc -o attribute.o -c attribute.c
attribute.c:3:1: warning: bad option ‘-fdata-sections’ to attribute ‘optimize’
[-Wattributes]
{
^
More information about the Gcc-bugs
mailing list