https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84603

            Bug ID: 84603
           Summary: -finline-limit not accepted in attribute and #pragma
                    optimize
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

In testing my patch for bug 83871 I tried to verify that
DECL_DISREGARD_INLINE_LIMITS() is being handled as expected by
duplicate_decls().  I found out that even though the C and C++ front ends try
to handle the limits the -finline-limit option itself is not recognized by
either attribute optimize or #pragma GCC optimize.

Debugging the code shows that the warning is issued by parse_optimize_options()
in response to options that aren't tagged as optimization options.  Sure
enough, common.opt doesn't specify Optimization for the option:

  finline-limit-
  Common RejectNegative Joined Alias(finline-limit=)

  finline-limit=
  Common RejectNegative Joined UInteger
  -finline-limit=<number>       Limit the size of inlined functions to
<number>.

$ cat b.c && gcc -O1 -S -Wall -Wextra -finline-limit=16 b.c
#pragma GCC optimize ("inline-functions")

void f0 (void);

#pragma GCC optimize ("align-loops=32")

void f1 (void);

#pragma GCC optimize ("inline-limit=32")

void f2 (void);

void __attribute__ ((optimize ("inline-functions")))
f3(void);

void __attribute__ ((optimize ("inline-limit=100")))
f4 (void);
b.c:9:9: warning: bad option ‘-finline-limit=32’ to pragma ‘optimize’
[-Wpragmas]
 #pragma GCC optimize ("inline-limit=32")
         ^~~
b.c:11:1: warning: bad option ‘-finline-limit=32’ to attribute ‘optimize’
[-Wattributes]
 void f2 (void);
 ^~~~
b.c:14:1: warning: bad option ‘-finline-limit=32’ to attribute ‘optimize’
[-Wattributes]
 f3(void);
 ^~
b.c:17:1: warning: bad option ‘-finline-limit=32’ to attribute ‘optimize’
[-Wattributes]
 f4 (void);
 ^~
b.c:17:1: warning: bad option ‘-finline-limit=100’ to attribute ‘optimize’
[-Wattributes]

Reply via email to