public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16307] New: -Wchar-subscripts broken
@ 2004-07-01  0:57 sebor at roguewave dot com
  2004-07-01  5:01 ` [Bug c++/16307] -Wchar-subscripts does not warn on pointers pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: sebor at roguewave dot com @ 2004-07-01  0:57 UTC (permalink / raw)
  To: gcc-bugs

The -Wchar-subscripts option doesn't seem to have any effect. IIRC,
it used to work at some point in the past but this test case doesn't
seem to trigger it in any compiler between 2.95 and 3.4 regardless
of whether char is signed or unsigned.

$ cat t.cpp && g++ --version && g++ -Wchar-subscripts t.cpp
char foo (const char *s)
{
    return s [s ['\x80']];
}

int main ()
{
    foo ("\x80");
}

g++ (GCC) 3.4.0
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

-- 
           Summary: -Wchar-subscripts broken
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/16307] -Wchar-subscripts does not warn on pointers
  2004-07-01  0:57 [Bug c++/16307] New: -Wchar-subscripts broken sebor at roguewave dot com
@ 2004-07-01  5:01 ` pinskia at gcc dot gnu dot org
  2004-11-20 20:42 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-01  5:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-01 05:00 -------
Confirmed, it only ever worked on a really arrays and not pointers.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-01 05:00:58
               date|                            |
            Summary|-Wchar-subscripts broken    |-Wchar-subscripts does not
                   |                            |warn on pointers


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


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

* [Bug c++/16307] -Wchar-subscripts does not warn on pointers
  2004-07-01  0:57 [Bug c++/16307] New: -Wchar-subscripts broken sebor at roguewave dot com
  2004-07-01  5:01 ` [Bug c++/16307] -Wchar-subscripts does not warn on pointers pinskia at gcc dot gnu dot org
@ 2004-11-20 20:42 ` pinskia at gcc dot gnu dot org
  2004-11-20 20:48 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-20 20:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-20 20:42 -------
Fixed on the mainline by:
2004-11-20  Joseph S. Myers  <joseph@codesourcery.com>

	* c-typeck.c (build_array_ref): Don't check for index == 0.  Make
	checks for neither argument being an array or pointer (swapping
	the arguments if necessary), the array argument being a pointer to
	or array of functions and for -Wchar-subscripts warnings upfront.

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


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


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

* [Bug c++/16307] -Wchar-subscripts does not warn on pointers
  2004-07-01  0:57 [Bug c++/16307] New: -Wchar-subscripts broken sebor at roguewave dot com
  2004-07-01  5:01 ` [Bug c++/16307] -Wchar-subscripts does not warn on pointers pinskia at gcc dot gnu dot org
  2004-11-20 20:42 ` pinskia at gcc dot gnu dot org
@ 2004-11-20 20:48 ` pinskia at gcc dot gnu dot org
  2004-11-21  1:52 ` pinskia at gcc dot gnu dot org
  2005-02-12 22:35 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-20 20:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-20 20:48 -------
Oh, it is not fixed by that patch.

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


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


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

* [Bug c++/16307] -Wchar-subscripts does not warn on pointers
  2004-07-01  0:57 [Bug c++/16307] New: -Wchar-subscripts broken sebor at roguewave dot com
                   ` (2 preceding siblings ...)
  2004-11-20 20:48 ` pinskia at gcc dot gnu dot org
@ 2004-11-21  1:52 ` pinskia at gcc dot gnu dot org
  2005-02-12 22:35 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-21  1:52 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.0                       |---


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


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

* [Bug c++/16307] -Wchar-subscripts does not warn on pointers
  2004-07-01  0:57 [Bug c++/16307] New: -Wchar-subscripts broken sebor at roguewave dot com
                   ` (3 preceding siblings ...)
  2004-11-21  1:52 ` pinskia at gcc dot gnu dot org
@ 2005-02-12 22:35 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-12 22:35 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW


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


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

* [Bug c++/16307] -Wchar-subscripts does not warn on pointers
       [not found] <bug-16307-1186@http.gcc.gnu.org/bugzilla/>
  2006-10-28 23:23 ` mueller at gcc dot gnu dot org
  2006-10-29 18:38 ` mueller at gcc dot gnu dot org
@ 2006-10-29 19:13 ` mueller at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: mueller at gcc dot gnu dot org @ 2006-10-29 19:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from mueller at gcc dot gnu dot org  2006-10-29 19:13 -------
Fixed in 4.3


-- 

mueller at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/16307] -Wchar-subscripts does not warn on pointers
       [not found] <bug-16307-1186@http.gcc.gnu.org/bugzilla/>
  2006-10-28 23:23 ` mueller at gcc dot gnu dot org
@ 2006-10-29 18:38 ` mueller at gcc dot gnu dot org
  2006-10-29 19:13 ` mueller at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: mueller at gcc dot gnu dot org @ 2006-10-29 18:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mueller at gcc dot gnu dot org  2006-10-29 18:38 -------
Subject: Bug 16307

Author: mueller
Date: Sun Oct 29 18:38:26 2006
New Revision: 118154

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118154
Log:
2006-10-29  Dirk Mueller  <dmueller@suse.de>

        PR c++/16307
        * typeck.c (build_array_ref): Warn for char subscriptions
        on pointers.

        * g++.dg/warn/Wchar-subscripts-2.C: New testcase.


Added:
    trunk/gcc/testsuite/g++.dg/warn/Wchar-subscripts-2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/16307] -Wchar-subscripts does not warn on pointers
       [not found] <bug-16307-1186@http.gcc.gnu.org/bugzilla/>
@ 2006-10-28 23:23 ` mueller at gcc dot gnu dot org
  2006-10-29 18:38 ` mueller at gcc dot gnu dot org
  2006-10-29 19:13 ` mueller at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: mueller at gcc dot gnu dot org @ 2006-10-28 23:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from mueller at gcc dot gnu dot org  2006-10-28 23:22 -------
Testing patch.


-- 

mueller at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mueller at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

end of thread, other threads:[~2006-10-29 19:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-01  0:57 [Bug c++/16307] New: -Wchar-subscripts broken sebor at roguewave dot com
2004-07-01  5:01 ` [Bug c++/16307] -Wchar-subscripts does not warn on pointers pinskia at gcc dot gnu dot org
2004-11-20 20:42 ` pinskia at gcc dot gnu dot org
2004-11-20 20:48 ` pinskia at gcc dot gnu dot org
2004-11-21  1:52 ` pinskia at gcc dot gnu dot org
2005-02-12 22:35 ` pinskia at gcc dot gnu dot org
     [not found] <bug-16307-1186@http.gcc.gnu.org/bugzilla/>
2006-10-28 23:23 ` mueller at gcc dot gnu dot org
2006-10-29 18:38 ` mueller at gcc dot gnu dot org
2006-10-29 19:13 ` mueller 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).