This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 4.3.2 bug (was: Illegal subtraction in tmp-d ive_1.s)
- From: James Dennett <james dot dennett at gmail dot com>
- To: Jason Mancini <jayrusman at hotmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 20 Apr 2009 00:30:21 -0700
- Subject: Re: GCC 4.3.2 bug (was: Illegal subtraction in tmp-d ive_1.s)
- References: <BLU134-W80F579036A9BDF7FDA560AB760@phx.gbl>
2009/4/19 Jason Mancini <jayrusman@hotmail.com>:
>
>> Vincent Lefevre ?writes:
>> ? ?while ((*(q++))-- == 0) ;
>
> Is that defined and legal?? ?Is q incremented before or after *q is decremented? ?They are both post operators!
> Jason Mancini
It's defined and legal (so long as q != &q, which might well be
guaranteed by the type system for an incrementable q -- it's late, and
I might be missing a counterexample to that). The order of the
increment/decrement makes no difference except in the pathological
case where they attempt to change the same object (and in that case,
the behavior is undefined).
Note: the decrement is done to *initial_value_of_q, as q++ evaluates
to a copy of q's initial value. q could even be incremented before
that, so long as the decrement still applies to *initial_value_of_q.
All of this assumes the absence of "volatile", of course.
-- James