Clarification on gcc tail call optimization

Andrew Haley aph@redhat.com
Mon Oct 31 11:28:00 GMT 2016


On 31/10/16 10:28, raghesh wrote:
> I am trying to perform tail call optimization on the code given at the
> end of this mail (it is also attached).

 $ gcc -Wall -O2 struct.c
struct.c: In function 'h':
struct.c:25:36: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  struct arglist_g al_g = *((struct arglist_g *) &al);
                                    ^
struct.c: In function 'g':
struct.c:30:36: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  struct arglist_f al_f = *((struct arglist_f *) &al);
                                    ^
struct.c:37:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  struct arglist_max al_max = *((struct arglist_max *) &al_g);
                                        ^
struct.c:30:19: warning: unused variable 'al_f' [-Wunused-variable]
  struct arglist_f al_f = *((struct arglist_f *) &al);
                   ^
struct.c: In function 'f':
struct.c:47:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  struct arglist_max al_max = *((struct arglist_max *) &al_f);
                                        ^
Please fix these bugs and then get back to us.

Andrew.



More information about the Gcc-help mailing list