Re: g++ 4.8 fails with -Ox option

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

 



Jonathan Wakely wrote:
On 22 July 2013 17:22, Patrick Begou wrote:
Ian Lance Taylor wrote:

Using optimization changes how your library header files behave.  Look
for #ifdef __OPTIMIZE__ or defined(__OPTIMIZE__).  This looks like a
problem with your C library, not with GCC proper.

Ian

In http://gfortran.com/download/x86_64/PLEASE_README.txt the requirement for
glibc is :
"... The provided compilers need glibc 2.4 or newer, however the library
libgomp needs glibc 2.6...."

I am runing glibc-devel-2.11.3-12.59.1.x86_64
so my glibc level seams correct no ?
Yes, but Ian didn't say your glibc is too old.  Try looking for
__OPTIMIZE__ and figuring out why you get different declarations with
optimization enabled.

When optimization is enabled, the compiler uses an additional file: /usr/include/bits/stdio.h included from /usr/include/stdio.h. The problem raised from this file. /usr/include/stdio.h contains:
.....
/* If we are compiling with optimizing read this file.  It contains
   several optimizing inline functions and macros.  */
#ifdef __USE_EXTERN_INLINES
# include <bits/stdio.h>
#endif
....
but no  __OPTIMIZE__  directives.

That looks strange for me is:

1) g++ 4.8 shows the problem with glibc-devel-2.10.1-10.9.1.x86_64 and with glibc-devel-2.11.3-12.59.1.x86_64 on two different hosts.

2) On these hosts, compilation at -O2 and -O3 level is successful with :
 - gcc33-c++-3.3.3-15.3.x86_64,
 - gcc44-c++-4.4.1_20090817-2.3.4.x86_64
 - gcc-c++-4.5-19.1.x86_64,
 - gcc46-c++-4.6.3_20120531-105.1.x86_64

So I'm not sure that it is related to a bogus glibc....
I've attached the small C++ code generated by the configure step of openmpi.

Patrick

--
===================================================================
|  Equipe M.O.S.T.         |                                      |
|  Patrick BEGOU           | mailto:Patrick.Begou@xxxxxxxxxxxxxxx |
|  LEGI                    |                                      |
|  BP 53 X                 | Tel 04 76 82 51 35                   |
|  38041 GRENOBLE CEDEX    | Fax 04 76 82 52 71                   |
===================================================================

#include <stdio.h>
#include <stdlib.h>
 static long int longval () { return (long int) (sizeof (bool)); }
 static unsigned long int ulongval () { return (long int) (sizeof (bool)); }
 int
 main ()
 {
 
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
     return 1;
   if (((long int) (sizeof (bool))) < 0)
     {
       long int i = longval ();
       if (i != ((long int) (sizeof (bool))))
 	return 1;
       fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
       if (i != ((long int) (sizeof (bool))))
 	return 1;
       fprintf (f, "%lu", i);
     }
   /* Do not output a trailing newline, as this causes \r\n confusion
      on some platforms.  */
   return ferror (f) || fclose (f) != 0;
 
   ;
   return 0;
 }


[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