Incorrect union usage

Author: safoclCreated Jun 22, 2026Updated Jul 9, 2026
LabelsBugTriage

https://github.com/flipperdevices/flipperzero-firmware/blob/c9ab2b6827fc4d646e98ad0fc15a264240b58986/lib/mjs/mjs_gc.c#L141-L143 this is equivalent:

c
union {
  int a;
  char* b;
} u;

u.a = 42;
char* p = u.b; // this value is unspecified (b is not active member)

ISO/IEC 9899:TC2 Committee Draft — May 6, 2005 WG14/N1124

Annex J (informative) Portability issues J.1 Unspecified behavior

  1. The following are unspecified: — The value of a union member other than the last one stored into (6.2.6.1).

Source: flipperdevices/flipperzero-firmware