https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93196

--- Comment #17 from xiehongbiao <xiehongbiao at sensetime dot com> ---
(In reply to Andrew Pinski from comment #16)
> I don't see anything wrong with strace of the -O2 case.  In fact I see:
> [pid 10270] stat("a.out", {st_mode=S_IFREG|0755, st_size=8592, ...}) = 0
> [pid 10270] lstat("a.out", {st_mode=S_IFREG|0755, st_size=8592, ...}) = 0
> [pid 10270] unlink("a.out")             = 0
> [pid 10270] open("a.out", O_RDWR|O_CREAT|O_TRUNC, 0666) = 3
> ....
> ;; lots of writes
> [pid 10270] close(3)                    = 0
> [pid 10270] stat("a.out", {st_mode=S_IFREG|0644, st_size=8592, ...}) = 0
> [pid 10270] umask(0)                    = 022
> [pid 10270] umask(022)                  = 0
> [pid 10270] chmod("a.out", 0755)        = 0
> 
> The only thing I can think of is that the filesystem you are using has a
> race condition in it; in that the unlink happens after the open even though
> it was invoked first.  I have seen this when this when using NFS servers
> sometimes.
> 
> What file system are you using?

Thank you Andrew. It sounds reasonable. The filesystem is ext4.
Today I tried it in another PC. It's ubuntu16.04 as well. The gcc version I
tried is also 5.4.0 and 4.9. I don't know why but this problem can't be
reproduced on that mechine. The filesystem is also ext4

Reply via email to