public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/7054] #pragma pack handled incorrectly
       [not found] <20020617051601.7054.jbeulich@novell.com>
@ 2003-05-25  4:58 ` dhazeghi@yahoo.com
  2003-05-25 13:19 ` pinskia@physics.uc.edu
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: dhazeghi@yahoo.com @ 2003-05-25  4:58 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From dhazeghi@yahoo.com  2003-05-25 04:40 -------
Hello,

with gcc 3.2, I do indeed get the .align 2 in the outputted assembly. With gcc 3.3 branch and 
mainline (20030520), I get no .align whatsoever. Is this the proper behavior? Thanks,

Dara



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug c/7054] #pragma pack handled incorrectly
       [not found] <20020617051601.7054.jbeulich@novell.com>
  2003-05-25  4:58 ` [Bug c/7054] #pragma pack handled incorrectly dhazeghi@yahoo.com
@ 2003-05-25 13:19 ` pinskia@physics.uc.edu
  2003-05-26  7:54 ` jbeulich@novell.com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia@physics.uc.edu @ 2003-05-25 13:19 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia@physics.uc.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING





------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug c/7054] #pragma pack handled incorrectly
       [not found] <20020617051601.7054.jbeulich@novell.com>
  2003-05-25  4:58 ` [Bug c/7054] #pragma pack handled incorrectly dhazeghi@yahoo.com
  2003-05-25 13:19 ` pinskia@physics.uc.edu
@ 2003-05-26  7:54 ` jbeulich@novell.com
  2003-05-26 14:54 ` pinskia@physics.uc.edu
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: jbeulich@novell.com @ 2003-05-26  7:54 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From jbeulich@novell.com  2003-05-26 07:36 -------
Subject: Re: [Bug c/7054] #pragma pack handled incorrectly

Diff-ing c-pragma.c from gcc 3.2.2 (the last one the problem had been
actively observed with) and 3.3 shows there is no change relevant to the
problems described here. The fact that there is no .align 2 in the
output assembly anymore is meaningless for the test case provided since
that test case does not contain any global/static data. Instead, the
only meaningful aspect is the offset at which the u2 structure member is
being accessed.

Thank you.

>>> "pinskia@physics.uc.edu" <gcc-bugzilla@gcc.gnu.org> 25.05.03
15:09:34 >>>
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT*
gcc-bugs@gcc.gnu.org.

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


pinskia@physics.uc.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING





------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.




------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug c/7054] #pragma pack handled incorrectly
       [not found] <20020617051601.7054.jbeulich@novell.com>
                   ` (2 preceding siblings ...)
  2003-05-26  7:54 ` jbeulich@novell.com
@ 2003-05-26 14:54 ` pinskia@physics.uc.edu
  2003-06-02  3:42 ` pinskia@physics.uc.edu
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia@physics.uc.edu @ 2003-05-26 14:54 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia@physics.uc.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|0000-00-00 00:00:00         |2003-05-26 14:40:35
               date|                            |


------- Additional Comments From pinskia@physics.uc.edu  2003-05-26 14:40 -------
See submitter's comment.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug c/7054] #pragma pack handled incorrectly
       [not found] <20020617051601.7054.jbeulich@novell.com>
                   ` (3 preceding siblings ...)
  2003-05-26 14:54 ` pinskia@physics.uc.edu
@ 2003-06-02  3:42 ` pinskia@physics.uc.edu
  2003-11-20  7:53 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia@physics.uc.edu @ 2003-06-02  3:42 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia@physics.uc.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|2003-05-26 14:40:35         |2003-06-02 03:42:56
               date|                            |


------- Additional Comments From pinskia@physics.uc.edu  2003-06-02 03:42 -------
Woops this should not have been in waiting.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug c/7054] #pragma pack handled incorrectly
       [not found] <20020617051601.7054.jbeulich@novell.com>
                   ` (4 preceding siblings ...)
  2003-06-02  3:42 ` pinskia@physics.uc.edu
@ 2003-11-20  7:53 ` pinskia at gcc dot gnu dot org
  2003-11-20 15:00 ` jbeulich at novell dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-20  7:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-20 07:53 -------
What is the excepted offset?
I get this on the mainline for the code (-O3 -fomit-frame-pointer):
test:
        movl    4(%esp), %eax
        movl    12(%eax), %eax
        ret

-- 


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


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

* [Bug c/7054] #pragma pack handled incorrectly
       [not found] <20020617051601.7054.jbeulich@novell.com>
                   ` (5 preceding siblings ...)
  2003-11-20  7:53 ` pinskia at gcc dot gnu dot org
@ 2003-11-20 15:00 ` jbeulich at novell dot com
  2004-05-07 14:55 ` jbeulich at novell dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: jbeulich at novell dot com @ 2003-11-20 15:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jbeulich at novell dot com  2003-11-20 15:00 -------
This depends on the default alignment. With the example given you need a
compiler configured for 8-byte default alignment to see a difference (i.e.
Cygwin's, but not Linux'). When this is the case (which you can check by
compiling with the three pragma-s commented), the expected offset is 16. Then,
when you uncomment the block, the expected offset is still 16, but the offset
found is 12 as you checked.
On Linux, you could slightly change the example:

#pragma pack(push, 8)
#pragma pack(2)
#pragma pack(pop)

struct s {
	unsigned u1;
	unsigned short us;
	unsigned u2;
};

unsigned test(const struct s*ps) {
	return ps->u2;
}

where the expected offset with and without pragma-s is 8, but the one found with
pragma-s is 6.

-- 


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


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

* [Bug c/7054] #pragma pack handled incorrectly
       [not found] <20020617051601.7054.jbeulich@novell.com>
                   ` (6 preceding siblings ...)
  2003-11-20 15:00 ` jbeulich at novell dot com
@ 2004-05-07 14:55 ` jbeulich at novell dot com
  2004-05-07 15:03 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: jbeulich at novell dot com @ 2004-05-07 14:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jbeulich at novell dot com  2004-05-07 14:55 -------
Just submitted a patch suggestion to gcc-patches.

-- 


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


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

* [Bug c/7054] #pragma pack handled incorrectly
       [not found] <20020617051601.7054.jbeulich@novell.com>
                   ` (7 preceding siblings ...)
  2004-05-07 14:55 ` jbeulich at novell dot com
@ 2004-05-07 15:03 ` pinskia at gcc dot gnu dot org
  2004-05-20  2:24 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-07 15:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-07 15:03 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-05/msg00414.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug c/7054] #pragma pack handled incorrectly
       [not found] <20020617051601.7054.jbeulich@novell.com>
                   ` (8 preceding siblings ...)
  2004-05-07 15:03 ` pinskia at gcc dot gnu dot org
@ 2004-05-20  2:24 ` pinskia at gcc dot gnu dot org
  2004-09-03 17:22 ` cvs-commit at gcc dot gnu dot org
  2004-09-03 18:03 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-20  2:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-19 12:57 -------
Newest patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01189.html>.

-- 


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


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

* [Bug c/7054] #pragma pack handled incorrectly
       [not found] <20020617051601.7054.jbeulich@novell.com>
                   ` (9 preceding siblings ...)
  2004-05-20  2:24 ` pinskia at gcc dot gnu dot org
@ 2004-09-03 17:22 ` cvs-commit at gcc dot gnu dot org
  2004-09-03 18:03 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-09-03 17:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-09-03 17:22 -------
Subject: Bug 7054

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2004-09-03 17:22:40

Modified files:
	gcc            : ChangeLog c-pragma.c common.opt defaults.h 
	                 opts.c stor-layout.c tree.h 
	gcc/doc        : extend.texi invoke.texi tm.texi 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/abi: vbase10.C 
	gcc/testsuite/gcc.dg: Wpadded.c c99-flex-array-4.c pack-test-2.c 

Log message:
	PR c/7054
	* defaults.h (TARGET_DEFAULT_PACK_STRUCT): Provide default.
	* tree.h (initial_max_fld_align): Declare
	* stor-layout.c (initial_max_fld_align): Define and initialize.
	(maximum_field_alignment): Initialize to the same value.
	* common.opt: Add -fpack-struct= variant of switch.
	* opts.c: Handle -fpack-struct= variant of switch.
	* c-pragma.c: Change #pragma pack() handling so that it becomes
	compatible to other compilers: accept individual 'push' argument,
	make final pop restore (command line) default, correct interaction
	of push/pop and sole specification of a new alignment (so that the
	sequence #pragma pack(push) - #pragma pack(<n>) becomes identical
	to #pragma pack(push, <n>).
	* doc/extend.texi: New node "Structure-Packing Pragmas" under
	"Pragmas", describing #pragma pack.
	* doc/invoke.texi: Document -fpack-struct=<n> variant of switch.
	* doc/tm.texi: Adjust description for HANDLE_PRAGMA_PACK_PUSH_POP.
	Document new TARGET_DEFAULT_PACK_STRUCT.
	testsuite:
	* gcc.dg/pack-test-2.c: Adjust to permit and check #pragma pack(push).
	* gcc.dg/c99-flex-array-4.c: Add -fpack-struct=8 to provide a
	deterministic starting point for the alignment of structure fields.
	* gcc.dg/Wpadded.c: Dito.
	* g++.dg/abi/vbase10.C: Dito.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5231&r2=2.5232
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-pragma.c.diff?cvsroot=gcc&r1=1.74&r2=1.75
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/common.opt.diff?cvsroot=gcc&r1=1.48&r2=1.49
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/defaults.h.diff?cvsroot=gcc&r1=1.151&r2=1.152
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/opts.c.diff?cvsroot=gcc&r1=1.78&r2=1.79
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stor-layout.c.diff?cvsroot=gcc&r1=1.209&r2=1.210
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&r1=1.609&r2=1.610
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/extend.texi.diff?cvsroot=gcc&r1=1.209&r2=1.210
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&r1=1.521&r2=1.522
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/tm.texi.diff?cvsroot=gcc&r1=1.362&r2=1.363
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4237&r2=1.4238
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/abi/vbase10.C.diff?cvsroot=gcc&r1=1.4&r2=1.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/Wpadded.c.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/c99-flex-array-4.c.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pack-test-2.c.diff?cvsroot=gcc&r1=1.2&r2=1.3



-- 


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


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

* [Bug c/7054] #pragma pack handled incorrectly
       [not found] <20020617051601.7054.jbeulich@novell.com>
                   ` (10 preceding siblings ...)
  2004-09-03 17:22 ` cvs-commit at gcc dot gnu dot org
@ 2004-09-03 18:03 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-03 18:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-03 18:03 -------
Fixed for 3.5.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.5.0


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


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

end of thread, other threads:[~2004-09-03 18:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20020617051601.7054.jbeulich@novell.com>
2003-05-25  4:58 ` [Bug c/7054] #pragma pack handled incorrectly dhazeghi@yahoo.com
2003-05-25 13:19 ` pinskia@physics.uc.edu
2003-05-26  7:54 ` jbeulich@novell.com
2003-05-26 14:54 ` pinskia@physics.uc.edu
2003-06-02  3:42 ` pinskia@physics.uc.edu
2003-11-20  7:53 ` pinskia at gcc dot gnu dot org
2003-11-20 15:00 ` jbeulich at novell dot com
2004-05-07 14:55 ` jbeulich at novell dot com
2004-05-07 15:03 ` pinskia at gcc dot gnu dot org
2004-05-20  2:24 ` pinskia at gcc dot gnu dot org
2004-09-03 17:22 ` cvs-commit at gcc dot gnu dot org
2004-09-03 18:03 ` 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).