public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/38308]  New: -Wformat does not work for wide strings
@ 2008-11-28 16:38 bonzini at gnu dot org
  2008-11-28 17:00 ` [Bug c/38308] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bonzini at gnu dot org @ 2008-11-28 16:38 UTC (permalink / raw)
  To: gcc-bugs

GCC does not warn for this:

int main()
{
  wprintf (L"%s", 5);
}

GCC should try converting the string to single-byte (e.g. to UTF-8, which would
work for any wchar_t encoding in which 0-127 maps to char's encoding) and test
the format string.


-- 
           Summary: -Wformat does not work for wide strings
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bonzini at gnu dot org


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


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

* [Bug c/38308] -Wformat does not work for wide strings
  2008-11-28 16:38 [Bug c/38308] New: -Wformat does not work for wide strings bonzini at gnu dot org
@ 2008-11-28 17:00 ` pinskia at gcc dot gnu dot org
  2008-11-28 17:27 ` joseph at codesourcery dot com
  2008-11-29  3:13 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-11-28 17:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-11-28 16:58 -------
A patch was posted a while back:
http://gcc.gnu.org/ml/gcc-patches/2001-12/msg01579.html


-- 


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


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

* [Bug c/38308] -Wformat does not work for wide strings
  2008-11-28 16:38 [Bug c/38308] New: -Wformat does not work for wide strings bonzini at gnu dot org
  2008-11-28 17:00 ` [Bug c/38308] " pinskia at gcc dot gnu dot org
@ 2008-11-28 17:27 ` joseph at codesourcery dot com
  2008-11-29  3:13 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: joseph at codesourcery dot com @ 2008-11-28 17:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from joseph at codesourcery dot com  2008-11-28 17:26 -------
Subject: Re:  -Wformat does not work for wide strings

In view of the removal of c4x support I don't now think any patch for this 
needs to address the format of STRING_CSTs for non-8-bit target bytes.  
But it should still have appropriate accessors for extracting bytes / 
multibyte characters / wide characters from strings (such that support for 
non-8-bit target bytes could be added to those accessors later), though 
without necessarily finding all existing code that should be using those 
accessors.

See also bug 20110 on the format checking not allowing for the execution 
character set once it's extracted a character from the string.  For wide 
characters it's -fwide-exec-charset that's relevant.


-- 


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


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

* [Bug c/38308] -Wformat does not work for wide strings
  2008-11-28 16:38 [Bug c/38308] New: -Wformat does not work for wide strings bonzini at gnu dot org
  2008-11-28 17:00 ` [Bug c/38308] " pinskia at gcc dot gnu dot org
  2008-11-28 17:27 ` joseph at codesourcery dot com
@ 2008-11-29  3:13 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-11-29  3:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2008-11-29 03:12 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-11-29 03:12:35
               date|                            |


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


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

end of thread, other threads:[~2008-11-29  3:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-28 16:38 [Bug c/38308] New: -Wformat does not work for wide strings bonzini at gnu dot org
2008-11-28 17:00 ` [Bug c/38308] " pinskia at gcc dot gnu dot org
2008-11-28 17:27 ` joseph at codesourcery dot com
2008-11-29  3:13 ` 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).