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

            Bug ID: 78339
           Summary: -fcheck-pointer-bounds breaks
                    -fsuggest-attribute=noreturn on main 'exit'
           Product: gcc
           Version: 6.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eggert at gnu dot org
  Target Milestone: ---

I found this bug when trying to build Emacs with -fcheck-pointer-bounds.
Suppose the file profile.i contains:

extern _Noreturn void exit (int);
int main (void) { exit (1); }

Then when GCC 6.2.1 20160916 (Red Hat 6.2.1-2) x86-64 is invoked like this:

gcc -S -mmpx -fcheck-pointer-bounds -Wsuggest-attribute=noreturn profile.i

GCC issues the following bogus complaint:

profile.i: In function 'main.chkp':
profile.i:2:5: warning: function might be candidate for attribute 'noreturn'
[-Wsuggest-attribute=noreturn]
 int main (void) { exit (1); }
     ^~~~

The bogus complaint is not issued if the option -fcheck-pointer-bounds is
removed.

Reply via email to