Re: How to force gcc to report a warning/error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Paul,
We had an interesting error that was undetected in gcc:
{
   unsigned long a;
   unsigned long x=3;
   unsigned long y=4;
   a =
       min(x,y);
}

I've simplified the example. In the original code, the contents of the min()
statement were longer, so that it was on a separate line from the assignment
operation.
This shouldn't make any difference, because the gcc parser shouldn't care about newline (\n) characters in the input file.
Because of a bug, the assignment line was removed, and we had the following
code:
{
   unsigned long a;
   unsigned long x=3;
   unsigned long y=4;
       min(x,y);
}
This shouldn't happen. How did you get this output? By using preprocessor options like -E or -C? Which version of gcc are you using and how are you compiling your source file?
Should this be picked up as a warning/error?
Neither -Wall or -Wextra picked it up.
Well, depending on the bug, gcc can't possibly pick this up as a warning/error, because gcc doesn't know that it does something wrong.

Best regards,
Andi


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux