public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/30913]  New: SRA bugs with anon bitfields
@ 2007-02-21 14:28 jakub at gcc dot gnu dot org
  2007-02-21 15:18 ` [Bug tree-optimization/30913] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-02-21 14:28 UTC (permalink / raw)
  To: gcc-bugs

// gcc -O2 -Wall -S uninit-anon-bitfield.c

struct foo {
  unsigned int a:16;
  unsigned int b:11;
  unsigned int :5;
};

extern struct foo bar;

void foo(int a, int b)
{
  struct foo tmp;

  tmp.a = a;
  tmp.b = b;

  bar = tmp;
}

warns while it should not, the anon bitfield is just a padding, can't be
assigned to.  There is no warning with -fno-tree-sra.
The bug is in SRA IMHO, when scalarizing a struct assignment, it should
certainly
ignore the anon bitfields (TREE_CODE (x->element) == FIELD_DECL && DECL_NAME
(x->element) == NULL && TREE_CODE (TREE_TYPE (x->element)) == BIT_FIELD_TYPE
?).
Both in generate_element_copy, generate_copy_inout and perhaps in other places
as well.  Or not instantiate the anon bitfields at all.

There is another bug, e.g. for
struct foo {
  unsigned int a:16;
  unsigned int b:11;
  unsigned int :5;
};

extern struct foo bar;

void foo(struct foo a)
{
  struct foo tmp;

  tmp = a;

  bar = tmp;
}
SRA certainly should not have decided to use element copies at all, that makes
many times worse code.


-- 
           Summary: SRA bugs with anon bitfields
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/30913] SRA bugs with anon bitfields
  2007-02-21 14:28 [Bug tree-optimization/30913] New: SRA bugs with anon bitfields jakub at gcc dot gnu dot org
@ 2007-02-21 15:18 ` pinskia at gcc dot gnu dot org
  2007-02-22 23:46 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-21 15:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-02-21 15:18 -------
> SRA certainly should not have decided to use element copies at all, that makes
> many times worse code.

That is really unrelated to unanonymous bitfields and is a different bug and
has been filled already (I forgot the number but I filled it).


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/30913] SRA bugs with anon bitfields
  2007-02-21 14:28 [Bug tree-optimization/30913] New: SRA bugs with anon bitfields jakub at gcc dot gnu dot org
  2007-02-21 15:18 ` [Bug tree-optimization/30913] " pinskia at gcc dot gnu dot org
@ 2007-02-22 23:46 ` pinskia at gcc dot gnu dot org
  2010-04-09 10:58 ` jiez at gcc dot gnu dot org
  2010-04-09 11:03 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-22 23:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-02-22 23:45 -------
The second part of this bug is recorded as PR 22156.


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/30913] SRA bugs with anon bitfields
  2007-02-21 14:28 [Bug tree-optimization/30913] New: SRA bugs with anon bitfields jakub at gcc dot gnu dot org
  2007-02-21 15:18 ` [Bug tree-optimization/30913] " pinskia at gcc dot gnu dot org
  2007-02-22 23:46 ` pinskia at gcc dot gnu dot org
@ 2010-04-09 10:58 ` jiez at gcc dot gnu dot org
  2010-04-09 11:03 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jiez at gcc dot gnu dot org @ 2010-04-09 10:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jiez at gcc dot gnu dot org  2010-04-09 10:58 -------
It's not reproducible on svn trunk now.


-- 

jiez at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jiez at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/30913] SRA bugs with anon bitfields
  2007-02-21 14:28 [Bug tree-optimization/30913] New: SRA bugs with anon bitfields jakub at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-04-09 10:58 ` jiez at gcc dot gnu dot org
@ 2010-04-09 11:03 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-09 11:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2010-04-09 11:03 -------
Fixed in 4.3.0.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
      Known to fail|                            |4.2.4
      Known to work|                            |4.3.4 4.4.3 4.5.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-04-09 11:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-21 14:28 [Bug tree-optimization/30913] New: SRA bugs with anon bitfields jakub at gcc dot gnu dot org
2007-02-21 15:18 ` [Bug tree-optimization/30913] " pinskia at gcc dot gnu dot org
2007-02-22 23:46 ` pinskia at gcc dot gnu dot org
2010-04-09 10:58 ` jiez at gcc dot gnu dot org
2010-04-09 11:03 ` rguenth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).