This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/68281] '&&' is checked in reverse and reads an uninitialized value
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 11 Nov 2015 00:53:11 +0000
- Subject: [Bug c++/68281] '&&' is checked in reverse and reads an uninitialized value
- Auto-submitted: auto-generated
- References: <bug-68281-4 at http dot gcc dot gnu dot org/bugzilla/>
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.