This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/21323] New: GDB thinks char16_t and char32_t are signed in C++


https://sourceware.org/bugzilla/show_bug.cgi?id=21323

            Bug ID: 21323
           Summary: GDB thinks char16_t and char32_t are signed in C++
           Product: gdb
           Version: 7.11.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: jwakely.gcc at gmail dot com
  Target Milestone: ---

tmp$ cat c.c
#include <uchar.h>
int main()
{
  char16_t u16 = 0xf000;
  char32_t u32 = 0xf0000000;
  return 0;
}
tmp$ gcc c.c -g
tmp$ gdb -q -ex "br 6" -ex run -ex "p u16" -ex "p u32" -ex cont -ex quit a.out 
Reading symbols from a.out...done.
Breakpoint 1 at 0x4004e7: file c.c, line 6.
Starting program: /tmp/a.out 

Breakpoint 1, main () at c.c:6
6         return 0;
$1 = 61440 u''
$2 = 4026531840 U'\xf0000000'
Continuing.
[Inferior 1 (process 1258) exited normally]
tmp$ g++ c.c -g
tmp$ gdb -q -ex "br 6" -ex run -ex "p u16" -ex "p u32" -ex cont -ex quit a.out 
Reading symbols from a.out...done.
Breakpoint 1 at 0x4005a7: file c.c, line 6.
Starting program: /tmp/a.out 

Breakpoint 1, main () at c.c:6
6         return 0;
$1 = -4096 u''
$2 = -268435456 U'\xf0000000'
Continuing.
[Inferior 1 (process 1276) exited normally]

tmp$ gdb --version
GNU gdb (GDB) Fedora 7.11.1-86.fc24
...


The C++ standard is clear that they're unsigned types:

Types char16_t and char32_t denote distinct types with the same size,
signedness, and alignment as uint_least16_t and uint_least32_t, respectively,
in <cstdint>, called the underlying types.







Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]