public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/47599] New: -fno-short-wchar does not force long wchar
@ 2011-02-03 15:34 roucaries.bastien+bugs at gmail dot com
  2011-02-03 18:52 ` [Bug c/47599] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: roucaries.bastien+bugs at gmail dot com @ 2011-02-03 15:34 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: -fno-short-wchar does not force long wchar
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: roucaries.bastien+bugs@gmail.com


if WCHAR_TYPE is "short int" (cygwin) the following program produce always
short wchar. Please treat this option like -fno-short-enum

#include <wchar.h>
int x = sizeof (wchar_t);

$ gcc -S -o - foo.c
$ gcc -fshort-wchar -S -o - foo.c
$ gcc -fno-short-wchar -S -o - foo.c


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

* [Bug c/47599] -fno-short-wchar does not force long wchar
  2011-02-03 15:34 [Bug c/47599] New: -fno-short-wchar does not force long wchar roucaries.bastien+bugs at gmail dot com
@ 2011-02-03 18:52 ` pinskia at gcc dot gnu.org
  2011-02-04  8:21 ` roucaries.bastien+bugs at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-02-03 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-02-03 18:51:51 UTC ---
This is a header issue which means it is not a GCC bug.


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

* [Bug c/47599] -fno-short-wchar does not force long wchar
  2011-02-03 15:34 [Bug c/47599] New: -fno-short-wchar does not force long wchar roucaries.bastien+bugs at gmail dot com
  2011-02-03 18:52 ` [Bug c/47599] " pinskia at gcc dot gnu.org
@ 2011-02-04  8:21 ` roucaries.bastien+bugs at gmail dot com
  2011-02-04  8:27 ` roucaries.bastien+bugs at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: roucaries.bastien+bugs at gmail dot com @ 2011-02-04  8:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Bastien ROUCARIES <roucaries.bastien+bugs at gmail dot com> 2011-02-04 08:21:20 UTC ---
I disagree

wchar_t is a building type. Indeed L"aa" should expand to 16 bits packed char
with short wchar and 32 bits with no-short-wchar.

Due to the LNaaN constant specification wchar_t is more than a typedef stuff.

Bastien


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

* [Bug c/47599] -fno-short-wchar does not force long wchar
  2011-02-03 15:34 [Bug c/47599] New: -fno-short-wchar does not force long wchar roucaries.bastien+bugs at gmail dot com
  2011-02-03 18:52 ` [Bug c/47599] " pinskia at gcc dot gnu.org
  2011-02-04  8:21 ` roucaries.bastien+bugs at gmail dot com
@ 2011-02-04  8:27 ` roucaries.bastien+bugs at gmail dot com
  2011-02-04  8:33 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: roucaries.bastien+bugs at gmail dot com @ 2011-02-04  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Bastien ROUCARIES <roucaries.bastien+bugs at gmail dot com> 2011-02-04 08:27:40 UTC ---
BTW i have checked the source code, and if my memory is correct wchar_t is
defined as
MODIFIED_WCHAR_T = fshortwchar ? "Short int" : WCHAR_T

Where wchar_t is defined by the architecture config.

The problem is under arch where WCHAR_T is "short int" this flag have no
effect. This flag should behave as short-enum where arch specify a default that
could be overwritten

Bastien


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

* [Bug c/47599] -fno-short-wchar does not force long wchar
  2011-02-03 15:34 [Bug c/47599] New: -fno-short-wchar does not force long wchar roucaries.bastien+bugs at gmail dot com
                   ` (2 preceding siblings ...)
  2011-02-04  8:27 ` roucaries.bastien+bugs at gmail dot com
@ 2011-02-04  8:33 ` pinskia at gcc dot gnu.org
  2011-02-04  9:25 ` roucaries.bastien+bugs at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-02-04  8:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-02-04 08:33:03 UTC ---
It is a builtin type (for C++ it is exposed as the keyword, wchar_t). For C,
the headers define the type, see the preprocessed source to show that is the
case.


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

* [Bug c/47599] -fno-short-wchar does not force long wchar
  2011-02-03 15:34 [Bug c/47599] New: -fno-short-wchar does not force long wchar roucaries.bastien+bugs at gmail dot com
                   ` (3 preceding siblings ...)
  2011-02-04  8:33 ` pinskia at gcc dot gnu.org
@ 2011-02-04  9:25 ` roucaries.bastien+bugs at gmail dot com
  2011-02-04  9:39 ` roucaries.bastien+bugs at gmail dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: roucaries.bastien+bugs at gmail dot com @ 2011-02-04  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Bastien ROUCARIES <roucaries.bastien+bugs at gmail dot com> 2011-02-04 09:25:36 UTC ---
ok thanks it is defined in the header and in this case they are two bugs.

Try the following program

#include <stdio.h>
typedef __WCHAR_TYPE__ wchar_t;
wchar_t a[] = L"aa";
int s  = sizeof(wchar_t);

void main()
{
  printf("%i\n",s);
}

under linux it output 4
under linux with -fno-short-char it output 4
under linux with -fshort-char it output 2

under cygwin it output 2
nder linux with -fno-short-char it output 2 (BUG here)
under linux with -fshort-char it output 2


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

* [Bug c/47599] -fno-short-wchar does not force long wchar
  2011-02-03 15:34 [Bug c/47599] New: -fno-short-wchar does not force long wchar roucaries.bastien+bugs at gmail dot com
                   ` (4 preceding siblings ...)
  2011-02-04  9:25 ` roucaries.bastien+bugs at gmail dot com
@ 2011-02-04  9:39 ` roucaries.bastien+bugs at gmail dot com
  2011-02-04  9:41 ` roucaries.bastien+bugs at gmail dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: roucaries.bastien+bugs at gmail dot com @ 2011-02-04  9:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Bastien ROUCARIES <roucaries.bastien+bugs at gmail dot com> 2011-02-04 09:39:02 UTC ---
I have checked with gcc -E the following program:

typedef __WCHAR_TYPE__ wchar_t;

under linux it output typedef int wchar_t
under linux with -fno-short-char it output typedef int wchar_t
under linux with -fshort-char it output typedef short unsigned int wchar_t

under cygwin it output typedef short unsigned int wchar_t
nder linux with -fno-short-char it output typedef short unsigned int wchar_t
(BUG)
under linux with -fshort-char it output typedef short unsigned int wchar_t

Bastien


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

* [Bug c/47599] -fno-short-wchar does not force long wchar
  2011-02-03 15:34 [Bug c/47599] New: -fno-short-wchar does not force long wchar roucaries.bastien+bugs at gmail dot com
                   ` (5 preceding siblings ...)
  2011-02-04  9:39 ` roucaries.bastien+bugs at gmail dot com
@ 2011-02-04  9:41 ` roucaries.bastien+bugs at gmail dot com
  2011-06-10 10:14 ` roucaries.bastien+bugs at gmail dot com
  2012-11-12 20:15 ` earnie at users dot sourceforge.net
  8 siblings, 0 replies; 10+ messages in thread
From: roucaries.bastien+bugs at gmail dot com @ 2011-02-04  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Bastien ROUCARIES <roucaries.bastien+bugs at gmail dot com> 2011-02-04 09:41:04 UTC ---
Sorry replace the last linux by cygwin


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

* [Bug c/47599] -fno-short-wchar does not force long wchar
  2011-02-03 15:34 [Bug c/47599] New: -fno-short-wchar does not force long wchar roucaries.bastien+bugs at gmail dot com
                   ` (6 preceding siblings ...)
  2011-02-04  9:41 ` roucaries.bastien+bugs at gmail dot com
@ 2011-06-10 10:14 ` roucaries.bastien+bugs at gmail dot com
  2012-11-12 20:15 ` earnie at users dot sourceforge.net
  8 siblings, 0 replies; 10+ messages in thread
From: roucaries.bastien+bugs at gmail dot com @ 2011-06-10 10:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Bastien ROUCARIES <roucaries.bastien+bugs at gmail dot com> 2011-06-10 10:14:06 UTC ---
Any news of this bug ?


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

* [Bug c/47599] -fno-short-wchar does not force long wchar
  2011-02-03 15:34 [Bug c/47599] New: -fno-short-wchar does not force long wchar roucaries.bastien+bugs at gmail dot com
                   ` (7 preceding siblings ...)
  2011-06-10 10:14 ` roucaries.bastien+bugs at gmail dot com
@ 2012-11-12 20:15 ` earnie at users dot sourceforge.net
  8 siblings, 0 replies; 10+ messages in thread
From: earnie at users dot sourceforge.net @ 2012-11-12 20:15 UTC (permalink / raw)
  To: gcc-bugs


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

Earnie <earnie at users dot sourceforge.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |earnie at users dot
                   |                            |sourceforge.net

--- Comment #9 from Earnie <earnie at users dot sourceforge.net> 2012-11-12 20:15:07 UTC ---
Looking at http://msdn.microsoft.com/en-us/library/dh8che7s(v=vs.71).aspx I see
that wchar_t is "typically" defined as "unsigned short".  MSVC provides a
/Zc:wchar_t that causes wchar_t to become "a native type" that maps to
_wchar_t.

Currently the mingw.org wchar.h file includes the stddef.h file after defining
__need_wchar_t.  I need to walk through stddef.h to determine if we (mingw.org)
needs to define some other macro based on the provided options.  However, I'm
feeling like this will be a coordinated effort between both parties.  I don't
know about Cygwin's versions of the headers, they should match more to what
Linux defines.


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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-03 15:34 [Bug c/47599] New: -fno-short-wchar does not force long wchar roucaries.bastien+bugs at gmail dot com
2011-02-03 18:52 ` [Bug c/47599] " pinskia at gcc dot gnu.org
2011-02-04  8:21 ` roucaries.bastien+bugs at gmail dot com
2011-02-04  8:27 ` roucaries.bastien+bugs at gmail dot com
2011-02-04  8:33 ` pinskia at gcc dot gnu.org
2011-02-04  9:25 ` roucaries.bastien+bugs at gmail dot com
2011-02-04  9:39 ` roucaries.bastien+bugs at gmail dot com
2011-02-04  9:41 ` roucaries.bastien+bugs at gmail dot com
2011-06-10 10:14 ` roucaries.bastien+bugs at gmail dot com
2012-11-12 20:15 ` earnie at users dot sourceforge.net

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