public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Should GCC publish a general rule/warning due to it's default presumption of undefined signed integer overflow semantics?
@ 2005-06-30 19:15 Paul Schlie
  2005-06-30 20:08 ` Paul Schlie
  2005-06-30 22:06 ` Joe Buck
  0 siblings, 2 replies; 27+ messages in thread
From: Paul Schlie @ 2005-06-30 19:15 UTC (permalink / raw)
  To: gcc

Given that the formal implication of GCC's choice not define signed integer
overflow semantics as being other than undefined will be to guaranteed that
all programs, with reachable signed integer arithmetic operations which can
not warrant that their respective operand expressions are recursively
constrained to each others corresponding additive, multiplicative inverse,
may produce unpredictably arbitrary results and/or behavior by default;
might it be a good idea to publish a formal rule/warning, as it's a good
thing to know and not particularly obvious:

- Signed integer types and/or arithmetic operations should not be utilized
  in GCC compiled programs (or any program desired to be strictly portable,
  even if it's values are known or desired to be constrained to signed
  integers) unless it is provably known that the corresponding operands to
  all signed arithmetic operation which may use their values directly and/or
  indirectly are correspondingly recursively constrained to their respective
  additive or multiplicative inverse. As GCC complied programs may produce
  arbitrary results and/or behavior in such instances by default, as enabled
  by the C/C++ standards.

Or more generally as C/C++'s default integer promotion rules may convert
unsigned integer types to signed operand types if it's other operand is
signed, should the general rule be broadened to discourage the use of all
integer variable types unless all signed integer operations which may
utilize their values directly or indirectly are provably known to have
their correspondingly operands constrained to their respective additive or
multiplicative inverse value ranges?

(or if by default it warrants otherwise, maybe that should be stated?)


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2005-07-03  0:20 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-30 19:15 Should GCC publish a general rule/warning due to it's default presumption of undefined signed integer overflow semantics? Paul Schlie
2005-06-30 20:08 ` Paul Schlie
2005-06-30 22:06 ` Joe Buck
2005-06-30 22:26   ` Gabriel Dos Reis
2005-06-30 23:25     ` Joe Buck
2005-07-01  0:49       ` Gabriel Dos Reis
2005-07-01  1:03         ` Andrew Pinski
2005-07-01  1:23           ` Gabriel Dos Reis
2005-07-01  1:25           ` Joe Buck
2005-07-01  1:40             ` Gabriel Dos Reis
2005-07-01  3:16               ` Daniel Berlin
2005-07-01  4:07                 ` Gabriel Dos Reis
2005-07-01  4:15                   ` Andrew Pinski
2005-07-01  4:58                     ` Gabriel Dos Reis
2005-07-01  4:53                       ` Andrew Pinski
2005-07-01  5:02                         ` Gabriel Dos Reis
2005-07-02 16:51                   ` Robert Dewar
2005-07-02 19:07                     ` Gabriel Dos Reis
2005-07-02 23:15                       ` Robert Dewar
2005-07-02 23:28                         ` Joe Buck
2005-07-03  0:20                           ` Gabriel Dos Reis
2005-07-03  0:16                         ` Gabriel Dos Reis
2005-07-02 16:47           ` Robert Dewar
2005-07-02 16:45         ` Robert Dewar
2005-07-01  1:04       ` Paul Schlie
2005-07-02 16:48         ` Robert Dewar
2005-07-01  1:35       ` Paul Schlie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).