Guest User

Corrected form of https://gcc.gnu.org/bugzilla/show_bug.cgi?

a guest
Feb 15th, 2016
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. union Alias {
  5. int pi;
  6. double pd;
  7. };
  8.  
  9. int main()
  10. {
  11. void *p = malloc(10);
  12. union Alias* alias = p;
  13.  
  14. alias->pi = 1;
  15. printf("*pi = %d\n", alias->pi);
  16.  
  17. int a = alias->pi;
  18. alias->pd = 0;
  19. alias->pi = a;
  20.  
  21. printf("p = %p\n", p);
  22. printf("*pi = %d\n", alias->pi);
  23. }
Add Comment
Please, Sign In to add comment