public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26670]  New: attribute((packed)) sometimes not ignored for non-PODs
@ 2006-03-13 23:11 debian-gcc at lists dot debian dot org
  2006-03-13 23:15 ` [Bug c++/26670] " pinskia at gcc dot gnu dot org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2006-03-13 23:11 UTC (permalink / raw)
  To: gcc-bugs

[forwarded from http://bugs.debian.org/356548]

Under some circumstances, non-PODs are not properly stripped of their
packedness:

struct nonpod {
    nonpod();
};

struct nonpod_pack {
    nonpod n;
} __attribute__ ((packed));

struct nonpod_pack2 {
    nonpod_pack p;
} __attribute__ ((packed));

gives

foo.cc:6: warning: ignoring packed attribute on unpacked non-POD field 'nonpod
nonpod_pack::n'

nonpod_pack2::p should also have the packedness ignored, since it is a non-POD.


-- 
           Summary: attribute((packed)) sometimes not ignored for non-PODs
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
@ 2006-03-13 23:15 ` pinskia at gcc dot gnu dot org
  2006-03-13 23:53 ` debian-gcc at lists dot debian dot org
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-13 23:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-03-13 23:15 -------
Hmm, it does not warn about non-PODs which contain non-PODS which had been
warned about already.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
  2006-03-13 23:15 ` [Bug c++/26670] " pinskia at gcc dot gnu dot org
@ 2006-03-13 23:53 ` debian-gcc at lists dot debian dot org
  2006-03-16  5:35 ` pinskia at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2006-03-13 23:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from debian-gcc at lists dot debian dot org  2006-03-13 23:53 -------
It's not just a missing warning, it also changes behavior:

int& foo(nonpod_pack& n) {
    return n.n.i;               // this passes
}

int& foo(nonpod_pack2& p) {
    return p.p.n.i;             // this barfs
}


-- 


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
  2006-03-13 23:15 ` [Bug c++/26670] " pinskia at gcc dot gnu dot org
  2006-03-13 23:53 ` debian-gcc at lists dot debian dot org
@ 2006-03-16  5:35 ` pinskia at gcc dot gnu dot org
  2006-03-16  5:36 ` pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-16  5:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-03-16 05:35 -------
Hmm, related to PR 13983.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |13983


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
                   ` (2 preceding siblings ...)
  2006-03-16  5:35 ` pinskia at gcc dot gnu dot org
@ 2006-03-16  5:36 ` pinskia at gcc dot gnu dot org
  2006-07-05 20:38 ` jason at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-16  5:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-03-16 05:36 -------
And to PR 17519.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |17519


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
                   ` (3 preceding siblings ...)
  2006-03-16  5:36 ` pinskia at gcc dot gnu dot org
@ 2006-07-05 20:38 ` jason at gcc dot gnu dot org
  2006-07-06  3:48 ` jason at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-07-05 20:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jason at gcc dot gnu dot org  2006-07-05 20:38 -------
This is intended behavior: a non-POD type which has been marked as packed can
be used as a packed field.  13983 and 17519 are bugs in that feature.

In this case, nonpod_pack::n is not packed, so it is safe to pack fields of
nonpod_pack type.


-- 

jason at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
                   ` (4 preceding siblings ...)
  2006-07-05 20:38 ` jason at gcc dot gnu dot org
@ 2006-07-06  3:48 ` jason at gcc dot gnu dot org
  2006-07-06  3:52 ` jason at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-07-06  3:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jason at gcc dot gnu dot org  2006-07-06 03:48 -------
Hmm, actually comment #2 does seem like a bug, both foos should compile
cleanly.


-- 

jason at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
                   ` (5 preceding siblings ...)
  2006-07-06  3:48 ` jason at gcc dot gnu dot org
@ 2006-07-06  3:52 ` jason at gcc dot gnu dot org
  2006-08-28  8:31 ` jason at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-07-06  3:52 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-07-06 03:52:12
               date|                            |


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
                   ` (6 preceding siblings ...)
  2006-07-06  3:52 ` jason at gcc dot gnu dot org
@ 2006-08-28  8:31 ` jason at gcc dot gnu dot org
  2006-08-29  6:55 ` jason at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-08-28  8:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jason at gcc dot gnu dot org  2006-08-28 08:31 -------
Or perhaps we should ignore the __attribute__ ((packed)) on nonpod_pack, since
one of its fields isn't safe to pack.  Yes, that seems like the right way to
handle this testcase.


-- 


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
                   ` (7 preceding siblings ...)
  2006-08-28  8:31 ` jason at gcc dot gnu dot org
@ 2006-08-29  6:55 ` jason at gcc dot gnu dot org
  2006-08-29  7:11 ` jason at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-08-29  6:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jason at gcc dot gnu dot org  2006-08-29 06:55 -------
Subject: Bug 26670

Author: jason
Date: Tue Aug 29 06:55:35 2006
New Revision: 116555

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116555
Log:
        PR c++/26670
        * class.c (check_field_decls): Unset TYPE_PACKED (t) if one of the
        fields can't be packed.

Added:
    trunk/gcc/testsuite/g++.dg/ext/packed11.C
Modified:
    trunk/gcc/cp/class.c


-- 


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
                   ` (8 preceding siblings ...)
  2006-08-29  6:55 ` jason at gcc dot gnu dot org
@ 2006-08-29  7:11 ` jason at gcc dot gnu dot org
  2006-08-30  3:54 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-08-29  7:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jason at gcc dot gnu dot org  2006-08-29 07:10 -------
Subject: Bug 26670

Author: jason
Date: Tue Aug 29 07:10:38 2006
New Revision: 116556

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116556
Log:
        PR c++/26670
        * class.c (check_field_decls): Unset TYPE_PACKED (t) if one of the
        fields can't be packed.

Modified:
    trunk/gcc/cp/ChangeLog


-- 


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
                   ` (9 preceding siblings ...)
  2006-08-29  7:11 ` jason at gcc dot gnu dot org
@ 2006-08-30  3:54 ` pinskia at gcc dot gnu dot org
  2006-08-30  5:26 ` debian-gcc at lists dot debian dot org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-30  3:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2006-08-30 03:54 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.2.0


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
                   ` (10 preceding siblings ...)
  2006-08-30  3:54 ` pinskia at gcc dot gnu dot org
@ 2006-08-30  5:26 ` debian-gcc at lists dot debian dot org
  2006-08-30 15:51 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2006-08-30  5:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from debian-gcc at lists dot debian dot org  2006-08-30 05:26 -------
reported against 4.1; bootstrapped 4.1.2 CVS with this patch with no
regressions. ok to apply to the 4.1 branch?

  Matthias


-- 

debian-gcc at lists dot debian dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org
             Status|RESOLVED                    |REOPENED
      Known to fail|                            |4.1.1
      Known to work|                            |4.2.0
         Resolution|FIXED                       |


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
                   ` (11 preceding siblings ...)
  2006-08-30  5:26 ` debian-gcc at lists dot debian dot org
@ 2006-08-30 15:51 ` jason at gcc dot gnu dot org
  2006-08-30 15:52 ` jason at gcc dot gnu dot org
  2006-08-30 15:53 ` jason at gcc dot gnu dot org
  14 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-08-30 15:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from jason at gcc dot gnu dot org  2006-08-30 15:51 -------
Subject: Bug 26670

Author: jason
Date: Wed Aug 30 15:51:17 2006
New Revision: 116591

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116591
Log:
        PR c++/26670
        * class.c (check_field_decls): Don't unset TYPE_PACKED until all
        the fields have been processed.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c


-- 


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
                   ` (12 preceding siblings ...)
  2006-08-30 15:51 ` jason at gcc dot gnu dot org
@ 2006-08-30 15:52 ` jason at gcc dot gnu dot org
  2006-08-30 15:53 ` jason at gcc dot gnu dot org
  14 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-08-30 15:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from jason at gcc dot gnu dot org  2006-08-30 15:52 -------
Subject: Bug 26670

Author: jason
Date: Wed Aug 30 15:52:12 2006
New Revision: 116592

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116592
Log:
        PR c++/26670
        * class.c (check_field_decls): Don't unset TYPE_PACKED until all
        the fields have been processed.

        PR c++/26670
        * class.c (check_field_decls): Unset TYPE_PACKED (t) if one of the
        fields can't be packed.

Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/class.c


-- 


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


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

* [Bug c++/26670] attribute((packed)) sometimes not ignored for non-PODs
  2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
                   ` (13 preceding siblings ...)
  2006-08-30 15:52 ` jason at gcc dot gnu dot org
@ 2006-08-30 15:53 ` jason at gcc dot gnu dot org
  14 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-08-30 15:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from jason at gcc dot gnu dot org  2006-08-30 15:52 -------
fixed on 4.1 branch too.


-- 

jason at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-08-30 15:53 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-13 23:11 [Bug c++/26670] New: attribute((packed)) sometimes not ignored for non-PODs debian-gcc at lists dot debian dot org
2006-03-13 23:15 ` [Bug c++/26670] " pinskia at gcc dot gnu dot org
2006-03-13 23:53 ` debian-gcc at lists dot debian dot org
2006-03-16  5:35 ` pinskia at gcc dot gnu dot org
2006-03-16  5:36 ` pinskia at gcc dot gnu dot org
2006-07-05 20:38 ` jason at gcc dot gnu dot org
2006-07-06  3:48 ` jason at gcc dot gnu dot org
2006-07-06  3:52 ` jason at gcc dot gnu dot org
2006-08-28  8:31 ` jason at gcc dot gnu dot org
2006-08-29  6:55 ` jason at gcc dot gnu dot org
2006-08-29  7:11 ` jason at gcc dot gnu dot org
2006-08-30  3:54 ` pinskia at gcc dot gnu dot org
2006-08-30  5:26 ` debian-gcc at lists dot debian dot org
2006-08-30 15:51 ` jason at gcc dot gnu dot org
2006-08-30 15:52 ` jason at gcc dot gnu dot org
2006-08-30 15:53 ` jason 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).