typedef union and structs works fine on ATmega 328 bot does not work on DUE

The ino file attached, compiles on ATmega328 and DUE.
However, the results are different on two environments.
O Arduino UNO, the function getRdsGroupType() works as expected (returns 15).
On Arduino DUE, that function returns 0.

No warning on Arduino UNO.

Some warning on DUE, see below. See also the comments in ino file attached.

Users/rcaratti/Documents/Arduino/typedef_union_struct_test/typedef_union_struct_test.ino: In function ‘uint8_t getRdsGroupType()’:
/Users/rcaratti/Documents/Arduino/typedef_union_struct_test/typedef_union_struct_test.ino:82:31: warning: ‘lblk.si47x_rds_blockb::refinedValues.si47x_rds_blockb::::groupType’ is used uninitialized in this function [-Wuninitialized]
return lblk.refinedValues.groupType; // should return 15.
/Users/rcaratti/Documents/Arduino/typedef_union_struct_test/typedef_union_struct_test.ino: In function ‘void setup()’:
/Users/rcaratti/Documents/Arduino/typedef_union_struct_test/typedef_union_struct_test.ino:62:58: warning: ‘lblk.si47x_rds_blockb::refinedValues.si47x_rds_blockb::::groupType’ is used uninitialized in this function [-Wuninitialized]
showValue(“Group Type…: %u”, getRdsGroupType());

typedef_union_struct_test.ino (2.55 KB)

Please read this post:

General Guidance and How to use the Forum

It is important to provide as much of the information that is needed to solve your problem as you can, in your first posts. The forum link above has guidelines for posting in a standard way that makes it easiest for people to provide you with useful answers. Making an effort to do this will greatly increase the number and quality of helpful responses that you get.

In this case, the problem is that you have added your sketch as an attachment. Unless the sketch is too large, it’s better if you post your code (using code tags!), rather than attach it. When it’s attached, we have to download it, create a folder then open your code in our IDE. And afterwards, the folder remains unless we navigate to the “Temp” folder and manually remove it. It’s much easier to just view the code in your post.
Please edit your post and insert your code inside it, using code tags. The code tags make the code look

like this

when posting source code files. It makes it easier to read, and can be copied with a single mouse click. Also, if you don’t do it, some of the character sequences in the code can be misinterpred by the forum code as italics or funny emoticons. The “Code: [Select]” feature allows someone to select the entire sketch so it can be easily copied and pasted into the IDE for testing.

What you are trying to do is no longer allowed in C++. It was a valid technique in C and perhaps earlier C++ versions, but from the C++ standard:

It's undefined behavior to read from the member of the union that wasn't most recently written. Many compilers implement, as a non-standard language extension, the ability to read inactive members of a union.

Undefined behavior means "the compiler can do whatever it likes". In your case, the compiler absolutely knows that the value last read was not the value last written, so it can return any value at all.