public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/27942]  New: packed union doesn't make the unaligned magic on sh64-*
@ 2006-06-07 23:13 kkojima at gcc dot gnu dot org
  2006-06-08  0:01 ` [Bug middle-end/27942] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2006-06-07 23:13 UTC (permalink / raw)
  To: gcc-bugs

union unaligned
{
  void *ptr;
} __attribute__((__packed__));

void *foo (void *p)
{
  return (((union unaligned *) p)->ptr);
}

is compiled to an aligned word access on sh64-*.  It was compiled
to an unaligned access before the patch

r114364 | echristo | 2006-06-05 04:50:48 +0900 (Mon, 05 Jun 2006) | 17 lines


-- 
           Summary: packed union doesn't make the unaligned magic on sh64-*
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kkojima at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: sh64-*-*


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


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

* [Bug middle-end/27942] packed union doesn't make the unaligned magic on sh64-*
  2006-06-07 23:13 [Bug middle-end/27942] New: packed union doesn't make the unaligned magic on sh64-* kkojima at gcc dot gnu dot org
@ 2006-06-08  0:01 ` pinskia at gcc dot gnu dot org
  2006-06-08  0:06 ` [Bug middle-end/27942] [4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-08  0:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-06-08 00:01 -------
*** Bug 27943 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug middle-end/27942] [4.2 Regression] packed union doesn't make the unaligned magic on sh64-*
  2006-06-07 23:13 [Bug middle-end/27942] New: packed union doesn't make the unaligned magic on sh64-* kkojima at gcc dot gnu dot org
  2006-06-08  0:01 ` [Bug middle-end/27942] " pinskia at gcc dot gnu dot org
@ 2006-06-08  0:06 ` pinskia at gcc dot gnu dot org
  2006-06-08  0:27 ` echristo at apple dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-08  0:06 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |echristo at gcc dot gnu dot
                   |                            |org
            Summary|packed union doesn't make   |[4.2 Regression] packed
                   |the unaligned magic on sh64-|union doesn't make the
                   |*                           |unaligned magic on sh64-*
   Target Milestone|---                         |4.2.0


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


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

* [Bug middle-end/27942] [4.2 Regression] packed union doesn't make the unaligned magic on sh64-*
  2006-06-07 23:13 [Bug middle-end/27942] New: packed union doesn't make the unaligned magic on sh64-* kkojima at gcc dot gnu dot org
  2006-06-08  0:01 ` [Bug middle-end/27942] " pinskia at gcc dot gnu dot org
  2006-06-08  0:06 ` [Bug middle-end/27942] [4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-06-08  0:27 ` echristo at apple dot com
  2006-06-08  2:26 ` kkojima at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: echristo at apple dot com @ 2006-06-08  0:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from echristo at apple dot com  2006-06-08 00:10 -------
Since you're using the MS abi then for sh64 you'll need to dig up where I'm
doing something wrong.


-- 


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


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

* [Bug middle-end/27942] [4.2 Regression] packed union doesn't make the unaligned magic on sh64-*
  2006-06-07 23:13 [Bug middle-end/27942] New: packed union doesn't make the unaligned magic on sh64-* kkojima at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-06-08  0:27 ` echristo at apple dot com
@ 2006-06-08  2:26 ` kkojima at gcc dot gnu dot org
  2006-06-08 18:57 ` echristo at apple dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2006-06-08  2:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from kkojima at gcc dot gnu dot org  2006-06-08 01:50 -------
It seems that r114364 adds the extra alignment for non bit-field
fields always for the ms_bitfield_layout_p case.  It looks the packed
attribute should be taken into account, though I'm unsure whether
it's the way of ms_bitfield or not.  How does this look?

--- ORIG/trunk/gcc/stor-layout.c        2006-06-06 10:02:03.000000000 +0900
+++ LOCAL/trunk/gcc/stor-layout.c       2006-06-07 23:16:01.000000000 +0900
@@ -693,7 +693,7 @@ update_alignment_for_field (record_layou
         the type, except that for zero-size bitfields this only
         applies if there was an immediately prior, nonzero-size
         bitfield.  (That's the way it is, experimentally.) */
-      if (!is_bitfield
+      if ((!is_bitfield && !DECL_PACKED (field))
          || (!integer_zerop (DECL_SIZE (field))
              ? !DECL_PACKED (field)
              : (rli->prev_field


-- 


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


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

* [Bug middle-end/27942] [4.2 Regression] packed union doesn't make the unaligned magic on sh64-*
  2006-06-07 23:13 [Bug middle-end/27942] New: packed union doesn't make the unaligned magic on sh64-* kkojima at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-06-08  2:26 ` kkojima at gcc dot gnu dot org
@ 2006-06-08 18:57 ` echristo at apple dot com
  2006-06-08 22:23 ` kkojima at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: echristo at apple dot com @ 2006-06-08 18:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from echristo at apple dot com  2006-06-08 18:14 -------
Well, I suppose the question is whether or not I'm doing something wrong here.
The alignment should be added unilaterally (as far as I can tell from the
documents that I included in the documentation). Part of the question is what
happens with the packed attribute? I've not seen any part of an abi document
that includes that. I'm perfectly willing to include your patch in - it
shouldn't affect anything else.


-- 


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


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

* [Bug middle-end/27942] [4.2 Regression] packed union doesn't make the unaligned magic on sh64-*
  2006-06-07 23:13 [Bug middle-end/27942] New: packed union doesn't make the unaligned magic on sh64-* kkojima at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-06-08 18:57 ` echristo at apple dot com
@ 2006-06-08 22:23 ` kkojima at gcc dot gnu dot org
  2006-06-08 22:25 ` echristo at apple dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2006-06-08 22:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from kkojima at gcc dot gnu dot org  2006-06-08 22:17 -------
I also couldn't find any document refering to it.  My patch is just
a guess from the behavior for nonzero-size bitfield with the packed
attribute appeared in the last 3 lines of my patch.  I'd like to
send my patch to gcc-patch to get comments for our abi question.


-- 


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


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

* [Bug middle-end/27942] [4.2 Regression] packed union doesn't make the unaligned magic on sh64-*
  2006-06-07 23:13 [Bug middle-end/27942] New: packed union doesn't make the unaligned magic on sh64-* kkojima at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2006-06-08 22:23 ` kkojima at gcc dot gnu dot org
@ 2006-06-08 22:25 ` echristo at apple dot com
  2006-06-11 13:57 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: echristo at apple dot com @ 2006-06-08 22:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from echristo at apple dot com  2006-06-08 22:23 -------
Sure. Sounds good. As I said, the ABI stuff I've seen (and helped write) don't
take packed into account anywhere :)


-- 


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


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

* [Bug middle-end/27942] [4.2 Regression] packed union doesn't make the unaligned magic on sh64-*
  2006-06-07 23:13 [Bug middle-end/27942] New: packed union doesn't make the unaligned magic on sh64-* kkojima at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2006-06-08 22:25 ` echristo at apple dot com
@ 2006-06-11 13:57 ` patchapp at dberlin dot org
  2006-06-12  0:02 ` kkojima at gcc dot gnu dot org
  2006-06-12  0:29 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: patchapp at dberlin dot org @ 2006-06-11 13:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from patchapp at dberlin dot org  2006-06-11 13:55 -------
Subject: Bug number PR 27942

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00569.html


-- 


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


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

* [Bug middle-end/27942] [4.2 Regression] packed union doesn't make the unaligned magic on sh64-*
  2006-06-07 23:13 [Bug middle-end/27942] New: packed union doesn't make the unaligned magic on sh64-* kkojima at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2006-06-11 13:57 ` patchapp at dberlin dot org
@ 2006-06-12  0:02 ` kkojima at gcc dot gnu dot org
  2006-06-12  0:29 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2006-06-12  0:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from kkojima at gcc dot gnu dot org  2006-06-11 23:10 -------
Subject: Bug 27942

Author: kkojima
Date: Sun Jun 11 23:09:58 2006
New Revision: 114552

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114552
Log:
        PR middle-end/27942
        * stor-layout.c (update_alignment_for_field): Don't add extra
        alignment for packed non-bitfield fields in ms_bitfield_layout_p
        code.

        * gcc.dg/attr-ms_struct-packed1.c: New.


Added:
    trunk/gcc/testsuite/gcc.dg/attr-ms_struct-packed1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/stor-layout.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/27942] [4.2 Regression] packed union doesn't make the unaligned magic on sh64-*
  2006-06-07 23:13 [Bug middle-end/27942] New: packed union doesn't make the unaligned magic on sh64-* kkojima at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2006-06-12  0:02 ` kkojima at gcc dot gnu dot org
@ 2006-06-12  0:29 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-12  0:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2006-06-12 00:24 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2006-06-12  0:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-07 23:13 [Bug middle-end/27942] New: packed union doesn't make the unaligned magic on sh64-* kkojima at gcc dot gnu dot org
2006-06-08  0:01 ` [Bug middle-end/27942] " pinskia at gcc dot gnu dot org
2006-06-08  0:06 ` [Bug middle-end/27942] [4.2 Regression] " pinskia at gcc dot gnu dot org
2006-06-08  0:27 ` echristo at apple dot com
2006-06-08  2:26 ` kkojima at gcc dot gnu dot org
2006-06-08 18:57 ` echristo at apple dot com
2006-06-08 22:23 ` kkojima at gcc dot gnu dot org
2006-06-08 22:25 ` echristo at apple dot com
2006-06-11 13:57 ` patchapp at dberlin dot org
2006-06-12  0:02 ` kkojima at gcc dot gnu dot org
2006-06-12  0:29 ` pinskia 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).