=?gb18030?b?ob5hYXJjaDY0ob91bmlvbntmbG9hdDE2X3Q7dWlu?==?gb18030?b?dDE2fQ==?=

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

 



when I build a union include float16_t and uint16 with aarch64-linux-gnu-gcc-6.2.0,I will get a random value at "-O2",but a unique value at "-O0".

case:
#include "arm_neon.h"
#include <stdio.h>

typedef union {
       float16_t m1;
       unsigned short m2;
}MYUNION;

int main(void)
{
       MYUNION U1;
       U1.m1 = 5;
       printf("m2 = 0x%x \n",U1.m2);
       return 0;
}


aarch64-linux-gnu-gcc test.c -S -O2
 1     .arch armv8-a
 2     .file   "test.c"
 3     .section    .text.startup,"ax",@progbits
 4     .align  2
 5     .p2align 3,,7
 6     .global main
 7     .type   main, %function
 8 main:
 9     stp x29, x30, [sp, -16]!
10     adrp    x0, .LC0
11     add x0, x0, :lo12:.LC0
12     mov w1, 61573
13     add x29, sp, 0
14     bl  printf
15     mov w0, 0
16     ldp x29, x30, [sp], 16
17     ret
18     .size   main, .-main
19     .section    .rodata.str1.8,"aMS",@progbits,1
20     .align  3
21 .LC0:
22     .string "m2 = 0x%x \n"
23     .ident  "GCC: (GNU) 6.2.0"
24     .section    .note.GNU-stack,"",@progbits


the "61573" is a random value,why?

btw:If I use "-O0" option, I will get a unique value .




[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