[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GCC optimizes integer overflow: bug or feature?
From: |
Gabriel Dos Reis |
Subject: |
Re: GCC optimizes integer overflow: bug or feature? |
Date: |
21 Dec 2006 03:38:12 +0100 |
Paul Brook <address@hidden> writes:
| > Compiler can optimize it any way it wants,
| > as long as result is the same as unoptimized one.
|
| We have an option for that. It's called -O0.
|
| Pretty much all optimization will change the behavior of your program. The
| important distinction is whether that difference is observable in valid
| programs. The whole point of langage standards is that they define what
| constitutes a valid program.
The problem is that what constitutes a valid program tends to differ
from what constitutes a useful program found in the wild. The
question for GCC is how to accomodate for the useful uses without
getting far away from both conformance and non-conformance.
I don't believe this particular issue of optimization based on
"undefined behaviour" can be resolved by just telling people "hey
look, the C standard says it is undefined, therefore we can optimize.
And if you're not happy, just tell the compiler not to optimize".
For not all undefined behaviour are equal, and undefined behaviour is
also a latitude given to implementors to better serve their base
users.
-- Gaby
- Re: GCC optimizes integer overflow: bug or feature?, (continued)
- Re: GCC optimizes integer overflow: bug or feature?, Robert Dewar, 2006/12/21
- Re: GCC optimizes integer overflow: bug or feature?, Denis Vlasenko, 2006/12/22
- RE: GCC optimizes integer overflow: bug or feature?, Dave Korn, 2006/12/22
- RE: GCC optimizes integer overflow: bug or feature?, Andrew Pinski, 2006/12/22
- Re: GCC optimizes integer overflow: bug or feature?, Robert Dewar, 2006/12/22
- Re: GCC optimizes integer overflow: bug or feature?, Andrew Pinski, 2006/12/22
- Re: GCC optimizes integer overflow: bug or feature?, Robert Dewar, 2006/12/22
- Re: GCC optimizes integer overflow: bug or feature?, Rask Ingemann Lambertsen, 2006/12/23
- Re: GCC optimizes integer overflow: bug or feature?, Denis Vlasenko, 2006/12/23
- Re: GCC optimizes integer overflow: bug or feature?, Rask Ingemann Lambertsen, 2006/12/23
- Re: GCC optimizes integer overflow: bug or feature?,
Gabriel Dos Reis <=
- Re: GCC optimizes integer overflow: bug or feature?, Robert Dewar, 2006/12/20
- Message not available
- Re: GCC optimizes integer overflow: bug or feature?, Paolo Bonzini, 2006/12/21
- Re: GCC optimizes integer overflow: bug or feature?, Paul Eggert, 2006/12/21
- Re: GCC optimizes integer overflow: bug or feature?, Joseph S. Myers, 2006/12/21
- Re: GCC optimizes integer overflow: bug or feature?, Paul Eggert, 2006/12/21
- Re: GCC optimizes integer overflow: bug or feature?, Ian Lance Taylor, 2006/12/21
- Re: GCC optimizes integer overflow: bug or feature?, Joseph S. Myers, 2006/12/21
- Re: GCC optimizes integer overflow: bug or feature?, Paul Eggert, 2006/12/21
- Re: GCC optimizes integer overflow: bug or feature?, Gabriel Dos Reis, 2006/12/21
- Re: GCC optimizes integer overflow: bug or feature?, Paolo Bonzini, 2006/12/22