gcc, strict-aliasing, and casting through a union

后端 未结 7 569
时光说笑
时光说笑 2020-11-28 06:22

Do you have any horror stories to tell? The GCC Manual recently added a warning regarding -fstrict-aliasing and casting a pointer through a union:

[.

7条回答
  •  野性不改
    2020-11-28 07:17

    I don't really understand your problem. The compiler did exactly what it was supposed to do in your example. The union conversion is what you did in f1. In f2 it's a normal pointer typecast, that you casted it to a union is irrelevant, it's still a pointer casting

提交回复
热议问题