* [Bug c/18740] Execution-time sizeof drops side effects
2004-11-30 16:38 [Bug c/18740] New: " terra at gnome dot org
@ 2004-11-30 17:09 ` pinskia at gcc dot gnu dot org
2004-11-30 22:24 ` bangerth at dealii dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-30 17:09 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18740
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/18740] Execution-time sizeof drops side effects
2004-11-30 16:38 [Bug c/18740] New: " terra at gnome dot org
2004-11-30 17:09 ` [Bug c/18740] " pinskia at gcc dot gnu dot org
@ 2004-11-30 22:24 ` bangerth at dealii dot org
2004-11-30 22:48 ` bangerth at dealii dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: bangerth at dealii dot org @ 2004-11-30 22:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-11-30 22:24 -------
That's not a bug. The standard says this:
5.3.3 Sizeof [expr.sizeof]
1 The sizeof operator yields the number of bytes in the object
representation of its operand. The operand is either an expression,
which is not evaluated, or a parenthesized type-id.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18740
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/18740] Execution-time sizeof drops side effects
2004-11-30 16:38 [Bug c/18740] New: " terra at gnome dot org
2004-11-30 17:09 ` [Bug c/18740] " pinskia at gcc dot gnu dot org
2004-11-30 22:24 ` bangerth at dealii dot org
@ 2004-11-30 22:48 ` bangerth at dealii dot org
2004-12-01 1:44 ` jsm28 at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: bangerth at dealii dot org @ 2004-11-30 22:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-11-30 22:48 -------
Actually, this requires more thought. I quoted from the C++ standard, but
the bug is for C, and the problem lies here: the code is
-----------------
size_t fsize3 (int n)
{
int i = 0;
char b[1][n+3]; // Variable length array.
size_t s = sizeof (b[i++]);
-----------------
Indeed, b[0] is a VLA (or is it? maybe it's the GNU extension that looks
so similar), and for that case, Morton pointed me correctly at 6.5.3.4/2 of
the C99 standard, which has a special provision for this:
If the type of the operand is a variable length array type, the
operand is evaluated; otherwise the operand is not evaluated...
Sorry for the confusion,
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18740
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/18740] Execution-time sizeof drops side effects
2004-11-30 16:38 [Bug c/18740] New: " terra at gnome dot org
` (2 preceding siblings ...)
2004-11-30 22:48 ` bangerth at dealii dot org
@ 2004-12-01 1:44 ` jsm28 at gcc dot gnu dot org
2004-12-21 11:16 ` ebotcazou at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2004-12-01 1:44 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |jsm28 at gcc dot gnu dot org
OtherBugsDependingO| |16989
nThis| |
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-12-01 01:44:07
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18740
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/18740] Execution-time sizeof drops side effects
2004-11-30 16:38 [Bug c/18740] New: " terra at gnome dot org
` (3 preceding siblings ...)
2004-12-01 1:44 ` jsm28 at gcc dot gnu dot org
@ 2004-12-21 11:16 ` ebotcazou at gcc dot gnu dot org
2004-12-21 13:39 ` rth at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2004-12-21 11:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ebotcazou at gcc dot gnu dot org 2004-12-21 11:15 -------
Reproducible on x86 and x86-64.
--
What |Removed |Added
----------------------------------------------------------------------------
GCC build triplet|sparc-sun-solaris2.8 |*-*-*
GCC host triplet|sparc-sun-solaris2.8 |*-*-*
GCC target triplet|sparc-sun-solaris2.8 |*-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18740
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/18740] Execution-time sizeof drops side effects
2004-11-30 16:38 [Bug c/18740] New: " terra at gnome dot org
` (4 preceding siblings ...)
2004-12-21 11:16 ` ebotcazou at gcc dot gnu dot org
@ 2004-12-21 13:39 ` rth at gcc dot gnu dot org
2004-12-21 13:43 ` rth at gcc dot gnu dot org
2005-02-12 22:35 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 11+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-12-21 13:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2004-12-21 13:39 -------
Not a bug. Sizeof *never* has side effects.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18740
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/18740] Execution-time sizeof drops side effects
2004-11-30 16:38 [Bug c/18740] New: " terra at gnome dot org
` (5 preceding siblings ...)
2004-12-21 13:39 ` rth at gcc dot gnu dot org
@ 2004-12-21 13:43 ` rth at gcc dot gnu dot org
2005-02-12 22:35 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 11+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-12-21 13:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2004-12-21 13:43 -------
I'm wrong. What a stupid thing to do to the C language.
Someone should be smacked.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18740
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/18740] Execution-time sizeof drops side effects
2004-11-30 16:38 [Bug c/18740] New: " terra at gnome dot org
` (6 preceding siblings ...)
2004-12-21 13:43 ` rth at gcc dot gnu dot org
@ 2005-02-12 22:35 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-12 22:35 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18740
^ permalink raw reply [flat|nested] 11+ messages in thread