[Bug c/48996] fixincl on Red Hat EL 5 breaks sys/stat.h fstat64()

2015-03-18 Thread psmith at gnu dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48996

--- Comment #7 from Paul Smith psmith at gnu dot org ---
I haven't seen this issue in a while and don't care enough to try to reproduce
it or to have it reopened, but as far as I can see the problem was pretty
clearly in the fixincl tool that comes with GCC.  I don't know if that's
considered C FE or not; perhaps I mis-categorized it.

Fixincl was adding __inline__ to functions in header files it was fixing, quite
inappropriately (in this case anyway).


[Bug c/48996] fixincl on Red Hat EL 5 breaks sys/stat.h fstat64()

2015-03-17 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48996

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 CC||mpolacek at gcc dot gnu.org
 Resolution|--- |INVALID

--- Comment #6 from Marek Polacek mpolacek at gcc dot gnu.org ---
Looks like a NOTABUG, and hardly a C FE issue.


[Bug c/48996] fixincl on Red Hat EL 5 breaks sys/stat.h fstat64()

2011-05-16 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48996

Richard Guenther rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2011.05.16 11:04:03
 Ever Confirmed|0   |1

--- Comment #1 from Richard Guenther rguenth at gcc dot gnu.org 2011-05-16 
11:04:03 UTC ---
Please provide the un-fixincluded sys/stat.h file.


[Bug c/48996] fixincl on Red Hat EL 5 breaks sys/stat.h fstat64()

2011-05-16 Thread psmith at gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48996

--- Comment #2 from psmith at gnu dot org 2011-05-16 11:56:33 UTC ---
Created attachment 24251
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=24251
Un-fixed sys/stat.h

Yes, sorry, it was silly not to have done that.


[Bug c/48996] fixincl on Red Hat EL 5 breaks sys/stat.h fstat64()

2011-05-16 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48996

--- Comment #3 from Richard Guenther rguenth at gcc dot gnu.org 2011-05-16 
13:07:56 UTC ---
I don't see anything wrong with the fixinclude though it is a bit fragile
as it wants to fixup both prototype and redicrected inline function and
both are not guarded with the same #ifdefs:


#ifdef __USE_LARGEFILE64
extern int stat64 (__const char *__restrict __file,
   struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));
extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
#endif

but

# if defined __USE_LARGEFILE64 \
   (! defined __USE_FILE_OFFSET64 \
  || (defined __REDIRECT_NTH  defined __OPTIMIZE__))
extern __inline__ int
__NTH (fstat64 (int __fd, struct stat64 *__statbuf))
{
  return __fxstat64 (_STAT_VER, __fd, __statbuf);
}
...

so if only the fixed fstat64 prototype remains after preprocessing that
will trigger the error you saw.

So, do you have a testcase that fails to build?  And which flags do
you pass?


[Bug c/48996] fixincl on Red Hat EL 5 breaks sys/stat.h fstat64()

2011-05-16 Thread psmith at gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48996

--- Comment #4 from psmith at gnu dot org 2011-05-16 15:07:40 UTC ---
I'm attaching a small test program that fails for me.  I'm just running the
compiler with c++ -o tstfstat.o -c tstfstat.cpp; no extra flags.

After looking more carefully I can see that when I build this without
optimization I get this problem; the ifdef around the definition of the inline
version is:

# if defined __USE_LARGEFILE64 \
   (! defined __USE_FILE_OFFSET64 \
  || (defined __REDIRECT_NTH  defined __OPTIMIZE__))

In my system __USE_LARGEFILE64 is 1, __USE_FILE_OFFSET64 is 1, and
__REDIRECT_NTH is defined.  So, this entire if statement is true if
__OPTIMIZE__ is true, and false otherwise.

On the other hand the declaration doesn't care about __OPTIMIZE__; it declares
the function to be __inline__ regardless.

Sure enough, when I add -O2 to the compile line I don't see any complaints from
the compiler.  However that's not something I can do :-).


[Bug c/48996] fixincl on Red Hat EL 5 breaks sys/stat.h fstat64()

2011-05-16 Thread psmith at gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48996

--- Comment #5 from psmith at gnu dot org 2011-05-16 15:08:35 UTC ---
Created attachment 24253
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=24253
Test invocation of fstat64()