[Bug target/39545] structures with zero-length array passed/returned inconsistently

2009-03-25 Thread ubizjak at gmail dot com


--- Comment #5 from ubizjak at gmail dot com  2009-03-25 13:21 ---
P1, so we won't forget to resolve this ABI issue before 4.4 branches.


-- 

ubizjak at gmail dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Priority|P3  |P1
   Last reconfirmed|-00-00 00:00:00 |2009-03-25 13:21:28
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39545



[Bug target/39545] structures with zero-length array passed/returned inconsistently

2009-03-24 Thread hjl dot tools at gmail dot com


--- Comment #1 from hjl dot tools at gmail dot com  2009-03-24 18:43 ---
i386.c has

static int
classify_argument (enum machine_mode mode, const_tree type, 
   enum x86_64_reg_class classes[MAX_CLASSES], int bit_offset)
{
  HOST_WIDE_INT bytes =
(mode == BLKmode) ? int_size_in_bytes (type) : (int) GET_MODE_SIZE (mode);
  int words = (bytes + (bit_offset % 64) / 8 + UNITS_PER_WORD - 1) /
UNITS_PER_WORD;

  /* Variable sized entities are always passed/returned in memory.  */
  if (bytes  0)
return 0;

bytes == 0 for char xxx[0] and bytes == -1 for char xxx[]. We can't
return char [] and char xxx[] is passed as pointer. So

  /* Variable sized entities are always passed/returned in memory.  */
  if (bytes  0)
return 0;

only applies to zero-length array in a structure like

struct line {
int length;
char contents[];
};

This patch was added by

http://gcc.gnu.org/ml/gcc-patches/2002-08/msg01595.html

Jan, what was the rational for this change?


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 CC||jh at suse dot cz


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39545



[Bug target/39545] structures with zero-length array passed/returned inconsistently

2009-03-24 Thread hjl dot tools at gmail dot com


--- Comment #2 from hjl dot tools at gmail dot com  2009-03-24 19:26 ---
A patch is posted at:

http://gcc.gnu.org/ml/gcc-patches/2009-03/msg01144.html


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 CC||ubizjak at gmail dot com
URL||http://gcc.gnu.org/ml/gcc-
   ||patches/2009-
   ||03/msg01144.html
   Target Milestone|--- |4.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39545



[Bug target/39545] structures with zero-length array passed/returned inconsistently

2009-03-24 Thread hjl dot tools at gmail dot com


--- Comment #3 from hjl dot tools at gmail dot com  2009-03-24 21:21 ---
The updated patch with testcases is at

http://gcc.gnu.org/ml/gcc-patches/2009-03/msg01155.html


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

URL|http://gcc.gnu.org/ml/gcc-  |http://gcc.gnu.org/ml/gcc-
   |patches/2009-   |patches/2009-
   |03/msg01144.html|03/msg01155.html


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39545



[Bug target/39545] structures with zero-length array passed/returned inconsistently

2009-03-24 Thread hjl dot tools at gmail dot com


--- Comment #4 from hjl dot tools at gmail dot com  2009-03-24 23:35 ---
The updated patch is at

http://gcc.gnu.org/ml/gcc-patches/2009-03/msg01161.html


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

URL|http://gcc.gnu.org/ml/gcc-  |http://gcc.gnu.org/ml/gcc-
   |patches/2009-   |patches/2009-
   |03/msg01155.html|03/msg01161.html


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39545