Nmap Development mailing list archives

Re: gcc 4 check is broken (luckily!)


From: David Fifield <david () bamsoftware com>
Date: Tue, 21 Jul 2009 18:17:06 -0600

On Mon, Jul 20, 2009 at 04:18:19AM +0400, Solar Designer wrote:
I am getting:

checking whether the compiler is gcc 4 or greater... yes

and -fno-strict-aliasing on gcc invocations on my system with gcc 3.4.5.
This is great, because gcc 3.4.5 supports the strict aliasing
optimizations as well, which would be problematic given Nmap's code.

The bug is here:

  if test 4 -ge $nmap_gcc_major_version; then

basically, the test is reversed, but due to the "or equal" it works
right for gcc 4 (but will break for gcc 5).  My suggested fix is:

  if test $nmap_gcc_major_version -ge 3; then

...or perhaps the minor version will need to be checked as well,
depending on when the -fno-strict-aliasing option was introduced (I did
not check, I am merely reporting a bug now).  Of course, the comments
and the message will need to be adjusted as well.

Good find. I looked and -fstrict-aliasing was introduced in 2.95.2 or
earlier (1999). I'm going to make it unconditional with GCC.

David Fifield

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: