This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/81269] New: wrong color highlighting in -Wrestrict warnings


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

            Bug ID: 81269
           Summary: wrong color highlighting in -Wrestrict warnings
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

Created attachment 41659
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41659&action=edit
Screenshot showing unexpected colors.

While testing an enhancement to -Wrestrict for sprintf (bug 35503) I noticed
some strange effects in the current implementation of the warning.

For the test case below, the first argument caret are pink, the second green,
the third blue, and the fourth green again.

I see even more unusual behavior in my enhancement.

$ cat b.c && gcc -O2 -S -Wall -Wrestrict b.c
extern int sprintf (char* restrict, const char*, ...);

void sink (void*);

void f (void)
{
  char d[5] = "1234";
  sprintf (d, "%s %s %s", d, d, d);
  sink (d);
}

b.c: In function ‘f’:
b.c:8:12: warning: passing argument 1 to restrict-qualified parameter aliases
with arguments 3, 4, 5 [-Wrestrict]
   sprintf (d, "%s %s %s", d, d, d);
            ^              ~  ~  ~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]