This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/81368] New: GCC reports bad option if -fdata-sections/-ffunction-sections is specified through #pragma or function attribute
- From: "sebastian.schrader at ossmail dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 09 Jul 2017 21:49:18 +0000
- Subject: [Bug c/81368] New: GCC reports bad option if -fdata-sections/-ffunction-sections is specified through #pragma or function attribute
- Auto-submitted: auto-generated
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]
{
^