[Bug c/10676] Using unnamed fields in initializers

2010-05-14 Thread balrogg at gmail dot com


--- Comment #18 from balrogg at gmail dot com  2010-05-15 03:23 ---
(In reply to comment #11)
> An example program that shows 3 different methods. Only one works (see 
> comment) 
>   .c = 3, //Will not work
>   {.c = 3}, //works
>   {.c= 2}, //Does not work

For sake of documentation, with versions from before the fix the second method
did not always work.  It seems to depend also on the ordering of the members in
the anonymous union.  If .c is the first, second or third member of the union
it seems to work.  It does not work for the fourth and following members. 
Really puzzling.


-- 

balrogg at gmail dot com changed:

   What|Removed |Added

 CC|            |balrogg at gmail dot com


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



[Bug c/39375] asm with a "=X" output overwrites the output

2009-03-16 Thread balrogg at gmail dot com


--- Comment #4 from balrogg at gmail dot com  2009-03-16 16:53 ---
Reopening because
int params; __asm__ ("xxx" : "=X" (params));
and
int params[1]; __asm__ ("xxx" : "=X" (params[0]));
still produce different output in a way that is undocumented.


-- 

balrogg at gmail dot com changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|INVALID |


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



[Bug c/39375] asm with a "=X" output overwrites the output

2009-03-06 Thread balrogg at gmail dot com


--- Comment #3 from balrogg at gmail dot com  2009-03-06 10:34 ---
(In reply to comment #2)
> You need to use a "memory" clobber instead.  "=X" (params[1]) says to GCC
> that the asm operand 0 should be stored to params[1], which it does
> (it allocates %eax to it).

Note that "=r" doesn't produce the useless move.  Neither does "=X" (params) if
params is an integer.

Note also that the documentation uses "=X" (sum) as an example of adding a
dependency on the asm statement.


-- 


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



[Bug c/39373] attribute ((aligned)) for stack variables is ignored without warning

2009-03-04 Thread balrogg at gmail dot com


--- Comment #2 from balrogg at gmail dot com  2009-03-05 07:32 ---
Yes!  I haven't executed it but correct assembly seems to be emitted for x86. 
Marking INVALID.


-- 

balrogg at gmail dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


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



[Bug c/39375] asm with a "=X" output overwrites the output

2009-03-04 Thread balrogg at gmail dot com


--- Comment #1 from balrogg at gmail dot com  2009-03-05 02:55 ---
(In reply to comment #0)
> Similarly for "=X" but not "=m" or "=r".

Rather, similarly for "=g".


-- 


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



[Bug c/39375] New: asm with a "=X" output overwrites the output

2009-03-04 Thread balrogg at gmail dot com
The info pages give something like
__asm__ ("xxx" : "=X" (sum));
as an example of adding a hint for gcc that the instruction clobbers "sum". 
However if the variable is an array element, gcc will clobber the variable for
you (in case you forgot) by generating a move from a random register to the
variable.  I don't know if liveness analysis is done on element basis for
arrays, but it doesn't generate warnings either.
Similarly for "=X" but not "=m" or "=r".

For example on x86,
__asm__ ("outl %%eax, (%%dx)" : "=X" (params[1]));
to indicate that the IO causes params[1] to be overwritten, results in:
  400532:   ef  out%eax,(%dx)
  400533:   89 45 f4mov%eax,-0xc(%rbp)
with all -O levels.

Similarly on ARM a move from r3 is generated that overwrites the array element.


-- 
   Summary: asm with a "=X" output overwrites the output
   Product: gcc
   Version: 4.3.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
         Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: balrogg at gmail dot com
 GCC build triplet: x86_64-linux-gnu, arm-linux-gnueabi
  GCC host triplet: x86_64-linux-gnu, arm-linux-gnueabi


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



[Bug c/39373] New: attribute ((aligned)) for stack variables is ignored without warning

2009-03-04 Thread balrogg at gmail dot com
For a non-static local variable with __attribute__ ((aligned (0x40))) gcc 4.3.3
makes no attempt in the generated code to align the variable and emitts no
warning about that.  Same if the type has the attribute specified instead of
the variable (the types I tried were an array of 6 uint64_t's or a struct
containing the array as a member).


-- 
   Summary: attribute ((aligned)) for stack variables is ignored
without warning
   Product: gcc
   Version: 4.3.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: balrogg at gmail dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu


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