Welcome to the Monastery | |
PerlMonks |
Re^4: Why does $Config{ccflags} include "-fwrapv" on many gcc builds of perl ?by syphilis (Archbishop) |
on Apr 24, 2021 at 01:04 UTC ( [id://11131678]=note: print w/replies, xml ) | Need Help?? |
I've since noticed that -fwrapv is omitted from CCFLAGS when I build perl on Windows using gcc-10.2.0.
So I created an issue about that, wherein I again queried the need for the -fwrapv switch.
In that thread, Tomasz Konojacki (@xenu) explains it clearly:
<quote> -fwrapv basically means "signed integer overflow won't cause undefined behavior". In practice, gcc with this flag disabled will still wrap signed integers on overflow, because that's how virtually all CPUs implement signed integer arithmetic. However, what does change is the behavior of the optimizer: it will assume that all signed integers will never overflow. Because of that, the breakage caused by omission of this flag is very subtle and unpredictable, and there's no reasonable way to test for it. </quote> That makes good sense to me, and I also provided a patch to win32/GNUmakefile that fixes that issue with gcc-10.x.x and (presumably) later. Cheers, Rob
In Section
Seekers of Perl Wisdom
|
|