bug-hurd
[Top][All Lists]
Advanced

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

Re: NULL struct to futimes does not return current date/time on GNU/Hurd


From: Samuel Thibault
Subject: Re: NULL struct to futimes does not return current date/time on GNU/Hurd
Date: Tue, 10 Oct 2006 10:57:24 +0200
User-agent: Mutt/1.5.11

Roland McGrath, le Tue 10 Oct 2006 00:16:25 -0700, a écrit :
> > Roland, what do you prefer?  Based on that I will then send in patches
> > also for the other *utimes.c files, which have similar problems, as the
> > code looks like.
> 
> I haven't figured out what you think this is fixing.

Glibc is compiled with -fstrict-aliasing, and hence casts like
        *(time_value_t*)&tvp[0]
don't propagate the "value is used" property, according to
strict C aliasing rules.  As a result, the

timevals[1].tv_usec = timevals[0].tv_usec = (time_t)-1;

statement is just optimized out!  See attached program that reproduces
the behavior of futimes.  Before 4.0, gcc was not able to optimize such
cases, but now it is.

Another solution would of course be to compile glibc with
-fno-strict-aliasing, but that will probably prevent a bunch of
optimizations.

Samuel

Attachment: test.c
Description: Text document

Attachment: test2.c
Description: Text document

Attachment: test2.h
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]