public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/52134] New: Does not fold (x * 4) & -4
@ 2012-02-06 10:51 rguenth at gcc dot gnu.org
  2012-02-06 14:08 ` [Bug middle-end/52134] " ebotcazou at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-06 10:51 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52134
           Summary: Does not fold (x * 4) & -4
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rguenth@gcc.gnu.org
                CC: ebotcazou@gcc.gnu.org


We appearantly do not fold

((sizetype) MAX_EXPR <R1b, 0> + 2) * 4

BIT_AND_EXPR

-4

as it happens for TYPE_SIZE_UNIT of a struct for gnat.dg/opt9.adb.

This causes an issue with trying to compute the extent/padding of
a trailing bitfield in such a struct when you do

size_diffop (TYPE_SIZE_UNIT (DECL_CONTEXT (field)),
             DECL_FIELD_OFFSET (repr));

where repr is the first field of a bitfield group and field is the last
field of a bitfield group.

The above expression computes non-constant

((ssizetype) (((sizetype) MAX_EXPR <R1b, 0> + 2) * 4) & -4) - (ssizetype)
((sizetype) MAX_EXPR <R1b, 0> * 4)

Not sure if such an expression cannot be reliably required to be constant
in ada though.

Certainly this looks like a missed folding (not sure how often this
odd BIT_AND_EXPR for sizes happen in Ada).


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

end of thread, other threads:[~2012-03-14  9:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-06 10:51 [Bug middle-end/52134] New: Does not fold (x * 4) & -4 rguenth at gcc dot gnu.org
2012-02-06 14:08 ` [Bug middle-end/52134] " ebotcazou at gcc dot gnu.org
2012-02-06 19:46 ` pinskia at gcc dot gnu.org
2012-03-13 11:42 ` rguenth at gcc dot gnu.org
2012-03-13 17:02 ` rguenth at gcc dot gnu.org
2012-03-13 17:08 ` rguenth at gcc dot gnu.org
2012-03-13 22:12 ` pinskia at gcc dot gnu.org
2012-03-13 22:50 ` ebotcazou at gcc dot gnu.org
2012-03-14  9:40 ` rguenther at suse dot de

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).