[Bug tree-optimization/101061] tree-vrp misoptimization on skylake+ using union-based aliasing
rguenther at suse dot de
gcc-bugzilla@gcc.gnu.org
Tue Jun 15 16:16:14 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101061
--- Comment #7 from rguenther at suse dot de <rguenther at suse dot de> ---
On June 15, 2021 4:21:12 PM GMT+02:00, "alexander.grund@tu-dresden.de"
<gcc-bugzilla@gcc.gnu.org> wrote:
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101061
>
>--- Comment #5 from Alexander Grund <alexander.grund@tu-dresden.de> ---
>So am I right assuming that the following is basically UB as per GCC
>(although
>it should work as per the standard)?
>
>template <class K, class V>
>union slot_type {
> map_slot_type() {}
> ~map_slot_type() = delete;
> using value_type = std::pair<const K, V>;
> using mutable_value_type = std::pair<K, V>;
>
> value_type value;
> mutable_value_type mutable_value;
> K key;
>};
>
>--> I.e. given a pointer `slot_type* slot` it _should_ have been
>possible to
>access `slot->value.first`, `slot->mutable_value.first`, `slot->key`
>interchangeably but in fact it is not, i.e. not implemented in GCC.
That's correct.
>I'm asking because it "may" work, and e.g. seemingly does in GCC 9+,
Yeah, the circumstances have been so there's incentive to do an invalid
transform...
>but
>yeah... If that is indeed unsupported I'll open a bug report against
>the repo
>using this. Note that this effectively disallows having "flat" maps
>that return
>`std::pair<const K, V>` via their iterators but have support for moving
>items
>effectively (i.e. via `std::pair<const K, V>` pointers)
More information about the Gcc-bugs
mailing list