public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17519] [3.4/4.0/4.1 Regression] Warning for array of packed non-POD in packed struct
       [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
@ 2005-10-23 19:54 ` pinskia at gcc dot gnu dot org
  2005-10-30 22:55 ` mmitchel at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-23 19:54 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
  GCC build triplet|i486-linux                  |
   GCC host triplet|i486-linux                  |
 GCC target triplet|i486-linux                  |


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


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

* [Bug c++/17519] [3.4/4.0/4.1 Regression] Warning for array of packed non-POD in packed struct
       [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
  2005-10-23 19:54 ` [Bug c++/17519] [3.4/4.0/4.1 Regression] Warning for array of packed non-POD in packed struct pinskia at gcc dot gnu dot org
@ 2005-10-30 22:55 ` mmitchel at gcc dot gnu dot org
  2006-02-10 18:22 ` [Bug c++/17519] [3.4/4.0/4.1/4.2 " amylaar at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-30 22:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from mmitchel at gcc dot gnu dot org  2005-10-30 22:55 -------
Leaving as P2; we should at least try to figure out whether we really want to
give a warning here.  

(I suspect we may end up closing this PR as INVALID, because the non-PODness
does affect things -- like whether the value is passed by reference or not when
calling a function.  But, I haven't thought hard enough to say for sure.)


-- 


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


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

* [Bug c++/17519] [3.4/4.0/4.1/4.2 Regression] Warning for array of packed non-POD in packed struct
       [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
  2005-10-23 19:54 ` [Bug c++/17519] [3.4/4.0/4.1 Regression] Warning for array of packed non-POD in packed struct pinskia at gcc dot gnu dot org
  2005-10-30 22:55 ` mmitchel at gcc dot gnu dot org
@ 2006-02-10 18:22 ` amylaar at gcc dot gnu dot org
  2006-02-15 11:53 ` titusjan at gmail dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2006-02-10 18:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from amylaar at gcc dot gnu dot org  2006-02-10 18:22 -------
(In reply to comment #4)
> There's certainly a good case for warning about packing that's likely not to
> have the desired results - we've been bitten by that before. But that doesn't
> really apply to all non-POD; you can define a subset safe-non-POD (broadly
> speaking, no virtual functions/bases and (recursively) no unsafe non-static data
> members) where everything still has reasonably predictable representations and
> you don't need extra space for polymorphism magic.

All the more reason to warn if we don't pack these members now, but we might
fix that in the future and thus change the data layout.
I.e. if the packed attribute is applied (individually or as part of an entire
struct / class) to a member, but ignored, and this is relevant for the size or
alignment of that member, we should warn.  That obviously applies for the
target
we are compiling for, but I think if possible, we should warn if the ignoring
of the packed attribute is relevant for any possible gcc target.
> 
> So if you do go in that direction, please consider separate warnings for those
> non-POD types that can nevertheless safely be packed and those that can't.
> Classes made non-POD through fairly innoccuous constructions - e.g.
> constructors, simple inheritance - are often useful in abstracting hardware
> registers, data formats, etc. We'd be swamped in warnings if we got one for
> every packed non-POD, but we definitely do want to know if there's something
> that's actually going to mess things up.


-- 


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


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

* [Bug c++/17519] [3.4/4.0/4.1/4.2 Regression] Warning for array of packed non-POD in packed struct
       [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-02-10 18:22 ` [Bug c++/17519] [3.4/4.0/4.1/4.2 " amylaar at gcc dot gnu dot org
@ 2006-02-15 11:53 ` titusjan at gmail dot com
  2006-02-16 20:12 ` nathan at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: titusjan at gmail dot com @ 2006-02-15 11:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from titusjan at gmail dot com  2006-02-15 11:53 -------
(In reply to comment #9)
> (In reply to comment #4)

[snip]

> All the more reason to warn if we don't pack these members now, but we might
> fix that in the future and thus change the data layout.
> I.e. if the packed attribute is applied (individually or as part of an entire
> struct / class) to a member, but ignored, and this is relevant for the size or
> alignment of that member, we should warn.  That obviously applies for the
> target
> we are compiling for, but I think if possible, we should warn if the ignoring
> of the packed attribute is relevant for any possible gcc target.

I've got non-POD objects that abstract endiannes and use them in arrays that
represent data-packets. The non-POD objects are quite simple, they don't use
inheritance or virtual methods. I use assert statements to verify the size of
the data-packets and notice that packing hasn't changed. Nevertheless, I get
this warning when changing from gcc 3.3 to 4.0.

Is this warning given because there are other targets where the packing will be
different, or because the packing might change in the future?

In the first case: I don't need my program to be portable to every possible GCC
target. I think it's my responsibility to ensure that it works on the relevant
targets and would only want to get a warning if the  packed attribute is
actually ignored.

In the second case: how likely is it that the packing will change in the
future? I don't see any reason why my objects can't be packed but I have no
knowledge of the GCC internals.

In any case, can this warning be suppressed or is there a simple workaround?
Since I use the asserts I'm not realy worried about missing the case when the
packet attribute is ignored.

Forgive me for using this bugtracking system as a helpdesk but I hope my
questions contribute to the discussion.

Pepijn.


-- 


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


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

* [Bug c++/17519] [3.4/4.0/4.1/4.2 Regression] Warning for array of packed non-POD in packed struct
       [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2006-02-15 11:53 ` titusjan at gmail dot com
@ 2006-02-16 20:12 ` nathan at gcc dot gnu dot org
  2006-02-17  8:39 ` titusjan at gmail dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: nathan at gcc dot gnu dot org @ 2006-02-16 20:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from nathan at gcc dot gnu dot org  2006-02-16 20:12 -------
Is this still an issue in 4.1/4.2. IIUC I've cleaned up the points where this
warning was/was not being emitted.


-- 


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


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

* [Bug c++/17519] [3.4/4.0/4.1/4.2 Regression] Warning for array of packed non-POD in packed struct
       [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2006-02-16 20:12 ` nathan at gcc dot gnu dot org
@ 2006-02-17  8:39 ` titusjan at gmail dot com
  2006-02-24  0:25 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: titusjan at gmail dot com @ 2006-02-17  8:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from titusjan at gmail dot com  2006-02-17 08:38 -------
(In reply to comment #11)
> Is this still an issue in 4.1/4.2. IIUC I've cleaned up the points where this
> warning was/was not being emitted.
> 

Ah. I've got 4.0.3. I'll check 4.1/4.2.


-- 


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


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

* [Bug c++/17519] [3.4/4.0/4.1/4.2 Regression] Warning for array of packed non-POD in packed struct
       [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2006-02-17  8:39 ` titusjan at gmail dot com
@ 2006-02-24  0:25 ` mmitchel at gcc dot gnu dot org
  2006-05-25  2:35 ` [Bug c++/17519] [4.0/4.1/4.2 " mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-02-24  0:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from mmitchel at gcc dot gnu dot org  2006-02-24 00:25 -------
This issue will not be resolved in GCC 4.1.0; retargeted at GCC 4.1.1.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.3                       |4.1.1


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


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

* [Bug c++/17519] [4.0/4.1/4.2 Regression] Warning for array of packed non-POD in packed struct
       [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2006-02-24  0:25 ` mmitchel at gcc dot gnu dot org
@ 2006-05-25  2:35 ` mmitchel at gcc dot gnu dot org
  2006-07-06  2:09 ` jason at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-25  2:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from mmitchel at gcc dot gnu dot org  2006-05-25 02:32 -------
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.1                       |4.1.2


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


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

* [Bug c++/17519] [4.0/4.1/4.2 Regression] Warning for array of packed non-POD in packed struct
       [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2006-05-25  2:35 ` [Bug c++/17519] [4.0/4.1/4.2 " mmitchel at gcc dot gnu dot org
@ 2006-07-06  2:09 ` jason at gcc dot gnu dot org
  2006-07-06  2:21 ` jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-07-06  2:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from jason at gcc dot gnu dot org  2006-07-06 02:09 -------
Subject: Bug 17519

Author: jason
Date: Thu Jul  6 02:09:02 2006
New Revision: 115217

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115217
Log:
        PR c++/13983
        PR c++/17519
        * stor-layout.c (finish_record_layout): Copy TYPE_PACKED to variants.
        * c-common.c (handle_packed_attribute): So don't copy it here.
        * c-decl.c (finish_struct): Don't copy TYPE_ALIGN.
        * cp/class.c (check_field_decls): Check TYPE_PACKED after
        stripping array types.
        (finish_struct_bits): Don't copy TYPE_SIZE here.

Added:
    trunk/gcc/testsuite/g++.dg/ext/packed10.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/c-decl.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c
    trunk/gcc/stor-layout.c


-- 


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


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

* [Bug c++/17519] [4.0/4.1/4.2 Regression] Warning for array of packed non-POD in packed struct
       [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2006-07-06  2:09 ` jason at gcc dot gnu dot org
@ 2006-07-06  2:21 ` jason at gcc dot gnu dot org
  2006-07-06  3:33 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-07-06  2:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from jason at gcc dot gnu dot org  2006-07-06 02:21 -------
Subject: Bug 17519

Author: jason
Date: Thu Jul  6 02:21:17 2006
New Revision: 115219

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115219
Log:
        PR c++/13983
        PR c++/17519
        * stor-layout.c (finish_record_layout): Copy TYPE_PACKED to variants.
        * cp/class.c (check_field_decls): Check TYPE_PACKED after
        stripping array types.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/ext/packed10.C
      - copied unchanged from r115217,
trunk/gcc/testsuite/g++.dg/ext/packed10.C
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/class.c
    branches/gcc-4_1-branch/gcc/stor-layout.c


-- 


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


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

* [Bug c++/17519] [4.0/4.1/4.2 Regression] Warning for array of packed non-POD in packed struct
       [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2006-07-06  2:21 ` jason at gcc dot gnu dot org
@ 2006-07-06  3:33 ` jason at gcc dot gnu dot org
  2006-07-06  3:45 ` jason at gcc dot gnu dot org
  2007-11-25 21:41 ` mdorey at bluearc dot com
  12 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-07-06  3:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from jason at gcc dot gnu dot org  2006-07-06 03:33 -------
Subject: Bug 17519

Author: jason
Date: Thu Jul  6 03:33:20 2006
New Revision: 115220

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115220
Log:
        PR c++/13983
        PR c++/17519
        * stor-layout.c (finish_record_layout): Copy TYPE_PACKED to variants.
        * cp/class.c (check_field_decls): Check TYPE_PACKED after
        stripping array types.

Added:
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/ext/packed10.C
      - copied unchanged from r115219,
branches/gcc-4_1-branch/gcc/testsuite/g++.dg/ext/packed10.C
Modified:
    branches/gcc-4_0-branch/gcc/ChangeLog
    branches/gcc-4_0-branch/gcc/cp/ChangeLog
    branches/gcc-4_0-branch/gcc/cp/class.c
    branches/gcc-4_0-branch/gcc/stor-layout.c


-- 


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


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

* [Bug c++/17519] [4.0/4.1/4.2 Regression] Warning for array of packed non-POD in packed struct
       [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2006-07-06  3:33 ` jason at gcc dot gnu dot org
@ 2006-07-06  3:45 ` jason at gcc dot gnu dot org
  2007-11-25 21:41 ` mdorey at bluearc dot com
  12 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-07-06  3:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from jason at gcc dot gnu dot org  2006-07-06 03:45 -------
f1x0r'd


-- 

jason at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/17519] [4.0/4.1/4.2 Regression] Warning for array of packed non-POD in packed struct
       [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2006-07-06  3:45 ` jason at gcc dot gnu dot org
@ 2007-11-25 21:41 ` mdorey at bluearc dot com
  12 siblings, 0 replies; 13+ messages in thread
From: mdorey at bluearc dot com @ 2007-11-25 21:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from mdorey at bluearc dot com  2007-11-25 21:41 -------
(We finally got round to throwing the switch on our next release from gcc-3.3
to gcc-4.2.  It works great - the compiled code gets us significantly higher
benchmark numbers and we're appreciating improved error reporting from the
compiler.  This PR had been the killer obstacle, so many, if belated, thanks to
Jason for sorting this out.)


-- 

mdorey at bluearc dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mdorey at bluearc dot com


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


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

end of thread, other threads:[~2007-11-25 21:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-17519-3259@http.gcc.gnu.org/bugzilla/>
2005-10-23 19:54 ` [Bug c++/17519] [3.4/4.0/4.1 Regression] Warning for array of packed non-POD in packed struct pinskia at gcc dot gnu dot org
2005-10-30 22:55 ` mmitchel at gcc dot gnu dot org
2006-02-10 18:22 ` [Bug c++/17519] [3.4/4.0/4.1/4.2 " amylaar at gcc dot gnu dot org
2006-02-15 11:53 ` titusjan at gmail dot com
2006-02-16 20:12 ` nathan at gcc dot gnu dot org
2006-02-17  8:39 ` titusjan at gmail dot com
2006-02-24  0:25 ` mmitchel at gcc dot gnu dot org
2006-05-25  2:35 ` [Bug c++/17519] [4.0/4.1/4.2 " mmitchel at gcc dot gnu dot org
2006-07-06  2:09 ` jason at gcc dot gnu dot org
2006-07-06  2:21 ` jason at gcc dot gnu dot org
2006-07-06  3:33 ` jason at gcc dot gnu dot org
2006-07-06  3:45 ` jason at gcc dot gnu dot org
2007-11-25 21:41 ` mdorey at bluearc dot com

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