Re: Another strict-alias puzzle with (unsigned) char ptrs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adam Dickmeiss <adam@xxxxxxxxxxxx> writes:

> The program below prints 1 or 0 depending on GCC version and
> -O2/-fstrict-aliasing being present or not. With proper optimizations
> enabled, 0 is printed. Otherwise, 1 is printed.
> 
> So just to understand: strict aliases also take effect for
> signed/unsigned char pointers?

Aliasing does not apply to char pointers.  That is, a pointer of type
char* is permitted to alias any other pointer, and likewise for
unsigned char* and signed char*.

> static void decode_ptr(const unsigned char **src)

But you aren't using a char* pointer, you are using a char** pointer.
And aliasing certainly does apply to char** pointers.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux