This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/68281] '&&' is checked in reverse and reads an uninitialized value


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68281

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Josh Stone from comment #2)
> This may also be significant:
> 
> bool
> base_query::get_number_param(literal_map_t const & params,
> 			     interned_string k, long & v)
> {
>   int64_t value;
>   bool present = derived_probe_builder::get_param (params, k, value);
>   v = (long) value;

This is an lvalue-to-rvalue conversion, which is undefined if value is
uninitialized, so the compiler can assume that value must always be initialized
by the call to get_param.

If this function body is visible when line 1002 is compiled the compiler can
assume that callees_num_val always gets set to a correctly initialized value,
so it's safe to re-order the conditions later.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]