Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to Re^3: Why does $Config{ccflags} include "-fwrapv" on many gcc builds of perl ?
in thread Why does $Config{ccflags} include "-fwrapv" on many gcc builds of perl ?

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11131678]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-19 07:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found