Tom Hughes writes:

On 06/08/2019 09:37, Miroslav Lichvar wrote:

Ok, but does that mean the program has to abort? Could gcc do anything
dangerous here? If we were actually trying to catch undefined behavior
(e.g. with -fsanitize=undefined), I suspect Fedora wouldn't even boot
without a crash.

Well of course the program doesn't have to abort - we have chosen to
compile in a mode where it does.

We do that because by default this is invoking the nasal daemons clause
and the compiler is allowed to do absolutely anything it feels like.

Earlier in the thread I posted some conflicting references from the standard, related to the additional requirements of contiguous containers, and the specification of the "*" operator, that leaves some room open for interpretation, here.

If you go by the formal specification of container and iterator requirements, this is undefined behavior. But std::vector is also specified as having "additional" requirements of a "contiguous container", whose semantics are specified in terms of std::addressof behavior, and that rabbit hole goes in a slightly different direction.


Attachment: pgpMuINH4vXci.pgp
Description: PGP signature

_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org

Reply via email to