This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Union an alias when the difference is the volatile qualifier?
- From: Jeffrey Walton <noloader at gmail dot com>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Sun, 2 Aug 2015 07:14:17 -0400
- Subject: Union an alias when the difference is the volatile qualifier?
- Authentication-results: sourceware.org; auth=none
- Reply-to: noloader at gmail dot com
According to -fno-strict-aliasing in the online manual
(https://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html):
Allow the compiler to assume the strictest aliasing rules ...
... unless the types are almost the same.
I think "almost the same" applies to sizes and alignments, and not
qualifiers like const and volatile.
Does GCC consider an 'int' and a 'volatile int' (or 'int*' and a
'volatile int*') almost the same?