public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/55322] New: Suggestion: Warn suspicious usage of arrays of structures
@ 2012-11-14 10:06 stilgarwolf at gmail dot com
  2012-11-14 13:30 ` [Bug c/55322] " mpolacek at gcc dot gnu.org
  2012-11-15 18:24 ` stilgarwolf at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: stilgarwolf at gmail dot com @ 2012-11-14 10:06 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55322
           Summary: Suggestion: Warn suspicious usage of arrays of
                    structures
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: stilgarwolf@gmail.com


struct {
   int x;
   int y;
} array[10];

void xxx() {
   int i=9;

   while(i--) {
      array[i].x = 0;
      array->y = 0;   /* an optional warning for this usage may be helpful */
   }
}


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

* [Bug c/55322] Suggestion: Warn suspicious usage of arrays of structures
  2012-11-14 10:06 [Bug c/55322] New: Suggestion: Warn suspicious usage of arrays of structures stilgarwolf at gmail dot com
@ 2012-11-14 13:30 ` mpolacek at gcc dot gnu.org
  2012-11-15 18:24 ` stilgarwolf at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-11-14 13:30 UTC (permalink / raw)
  To: gcc-bugs


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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> 2012-11-14 13:30:28 UTC ---
IMHO we don't want to warn on this.  It's legal to write array->y = 0 or
(*array).y = 0.


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

* [Bug c/55322] Suggestion: Warn suspicious usage of arrays of structures
  2012-11-14 10:06 [Bug c/55322] New: Suggestion: Warn suspicious usage of arrays of structures stilgarwolf at gmail dot com
  2012-11-14 13:30 ` [Bug c/55322] " mpolacek at gcc dot gnu.org
@ 2012-11-15 18:24 ` stilgarwolf at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: stilgarwolf at gmail dot com @ 2012-11-15 18:24 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Wolf <stilgarwolf at gmail dot com> 2012-11-15 18:23:51 UTC ---
I know it's legal, but it may be suspicious, like many other legal statements
which are, optionally, warned.
Anyway, such optional warning may be helpful.


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

end of thread, other threads:[~2012-11-15 18:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-14 10:06 [Bug c/55322] New: Suggestion: Warn suspicious usage of arrays of structures stilgarwolf at gmail dot com
2012-11-14 13:30 ` [Bug c/55322] " mpolacek at gcc dot gnu.org
2012-11-15 18:24 ` stilgarwolf at gmail 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).