# New Ticket Created by Bruce Gray # Please include the string: [perl #19462] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=19462 >
Summary: Whenever jit.h or debug.h are '#include'ed, gcc 3.x emits warnings about structure padding. These patches fix the problem. Detail: When compiling with gcc 3.x, Configure turns on flag -Wpadded: -Wpadded Warn if padding is included in a structure, either to align an element of the structure or to align the whole structure. Sometimes when this happens it is possible to rearrange the fields of the structure to reduce the padding and so make the structure smaller. This is causing 95 warnings to be emitted in 427 lines of output: 58 include/parrot/debug.h:53: warning: padding struct to align `value' 22 ../include/parrot/debug.h:53: warning: padding struct to align `value' 5 include/parrot/jit.h:35: warning: padding struct to align `param' 5 include/parrot/jit.h:123: warning: padding struct to align `block' 5 include/parrot/jit.h:149: warning: padding struct size to alignment boundary 58 In file included from include/parrot/interpreter.h:53, 58 from include/parrot/parrot.h:198, 58 from include/parrot/global_setup.h:18, 22 In file included from ../include/parrot/interpreter.h:53, 22 from ../include/parrot/parrot.h:198, 22 from ../include/parrot/global_setup.h:18, 1 In file included from nci.c:30: 1 In file included from jit_debug.c:14: 1 In file included from jit_cpu.c:12: 1 In file included from jit.c:8: 1 In file included from interpreter.c:19: ... 1 from boolean.c:22: 1 from array.c:27: In the past, these warnings have been resolved by rearranging the fields of the structure; that will not work in these cases. I have added dummy fields where the compiler was placing the padding, and marked each field with a comment. Note: I am not convinced that this is the right way to handle these warnings on *every* platform. We may need a different approach to best handle the Crays and toasters. Due to the high number of errors on our major development platform (Linux), please apply for (at least) the short term. -- Hope this helps, Bruce Gray -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/46288/36271/369a6d/warn_align_debug.patch -- attachment 2 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/46288/36272/58ece2/warn_align_jit.patch
Index: include/parrot/debug.h =================================================================== RCS file: /cvs/public/parrot/include/parrot/debug.h,v retrieving revision 1.18 diff -u -r1.18 debug.h --- include/parrot/debug.h 13 Oct 2002 09:39:45 -0000 1.18 +++ include/parrot/debug.h 26 Dec 2002 21:48:25 -0000 @@ -50,6 +50,7 @@ typedef struct PDB_condition { unsigned short type; unsigned char reg; + unsigned char dummy; /* For alignment */ void *value; PDB_condition_ptr next; } PDB_condition_t;
Index: include/parrot/jit.h =================================================================== RCS file: /cvs/public/parrot/include/parrot/jit.h,v retrieving revision 1.30 diff -u -r1.30 jit.h --- include/parrot/jit.h 14 Dec 2002 09:04:21 -0000 1.30 +++ include/parrot/jit.h 26 Dec 2002 21:54:02 -0000 @@ -29,6 +29,7 @@ int type; ptrdiff_t native_offset; char skip; + char dummy[3]; /* For alignment */ union { opcode_t opcode; void (*fptr)(void); @@ -120,6 +121,7 @@ unsigned int op_count; ptrdiff_t load_size; char isjit; + char dummy[3]; /* For alignment */ int block; Parrot_jit_optimizer_section_ptr branch_target; Parrot_jit_optimizer_section_ptr prev; @@ -146,6 +148,7 @@ char *map_branch; opcode_t **branch_list; unsigned char has_unpredictable_jump; + unsigned char dummy[3]; /* For alignment */ } Parrot_jit_optimizer_t; /* Parrot_jit_constant_pool_t