Re: A few Qs on the -Wfoo options

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

 



On 17/12/13 18:43, ballsystemlord wrote:
Ok, I've reread the docs. I had not noticed some of the entry before because
I did not read the sections on FORTRAN and C++. I also greped to info manual
but most of the options only had documentation for there '--no-'
counterparts.



-Wline-truncation           How can it be truncated?
Code of Fortran programs is truncated at a number of characters. Everything
after col 72 is a comment (there are options to change this limit, see -*ffixed-line-length*).

https://www.gnu.org/software/emacs/manual/html_node/emacs/Fortran-Columns.html

-Wimplicit-interface        What's an explicit interface?
One defined between 'interface' and 'end interface'? These are more language questions than
compiler doubts (fortran, in this case)

-Wimplicit-procedure        What's an explicit interface?
-Winvalid-memory-model      I could not find it mentioned in the info
manual.
Memory models are explained at http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/_005f_005fatomic-Builtins.html

-Wcharacter-truncation      "Warn when a character assignment will truncate
the assigned string." How/why would a string be truncated?
If you store into a variable able to store up to n characters data from another variable which can hold up to m, with m > n.

-Wlogical-op                Why would it give false positives? What's the
criteria under which it makes these assumptions?
It can give false positives if it's indeed what the author wanted. Note how in this
option it is trying to outsmart the programmer by noticing that he intended
to do something different than what he stated.
A example warned by -Wlogical-op would be: «if (var > 1 || var < 5) {»
Since var (assumed to be an int variable) will always be greater than 1 or
less than 5, there's something fishy with that if.

-Wstack-protector           How can a function get smashed?
'-Wstack-protector'
     This option is only active when '-fstack-protector' is active.  (...)

So you go to:

'-fstack-protector'
     Emit extra code to check for buffer overflows, such as stack
     smashing attacks.  This is done by adding a guard variable to
     functions with vulnerable objects.  This includes functions that
     call 'alloca', and functions with buffers larger than 8 bytes.  The
     guards are initialized when a function is entered and then checked
     when the function exits.  If a guard check fails, an error message
     is printed and the program exits.


So in two words: "Buffer overflows"





[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