PR c++/17880 -Wsequence-point doesn't warn inside if, while, do conditions, for beg/cond/end expressions etc.

Manuel López-Ibáñez lopezibanez@gmail.com
Mon Aug 25 17:45:00 GMT 2008


2008/8/25 Mark Mitchell <mark@codesourcery.com>:
> Manuel López-Ibáñez wrote:
>
>>> 2008-08-12  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
>>>
>>>        PR c++/17880
>>> cp/
>>>        * semantics.c (begin_if_stmt): Call verify_sequence_points.
>>>        (begin_while_stmt): Likewise.
>>>        (finish_do_body): Likewise.
>>>        (finish_return_stmt): Likewise.
>>>        (finish_for_init_stmt): Likewise.
>>>        (finish_switch_condition): Likewise.
>>> testsuite/
>>>        * g++.dg/warn/sequence-pt-1.C: New.
>>>        * g++.dg/warn/sequence-pt-pr17880.C: New.
>
> Does it work to add the verify_sequence_points call inside
> maybe_convert_cond instead?  Then, I think you will need it in fewer places.

I am not sure whether it works but maybe_convert_cond is called in
more places than those and verify_sequence_points looks quite
expensive. So I prefer to explicitly add it wherever is surely needed.
If you insist, I would prefer to call it
verify_sequence_points_and_maybe_convert_cond to avoid giving a false
impression of what it actually does.

Cheers,

Manuel.



More information about the Gcc-patches mailing list