public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/107884] New: H8/300: cp-demangle.c fix warning related demangle.h
@ 2022-11-26 23:16 uaa at mx5 dot nisiq.net
2022-11-27 0:19 ` [Bug demangler/107884] " pinskia at gcc dot gnu.org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: uaa at mx5 dot nisiq.net @ 2022-11-26 23:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107884
Bug ID: 107884
Summary: H8/300: cp-demangle.c fix warning related demangle.h
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: uaa at mx5 dot nisiq.net
Target Milestone: ---
Created attachment 53973
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53973&action=edit
pack DMGL_* option bit within 16bit width
On building gcc-12.2.0 with newlib-4.1.0 (newlib and libgloss) and
binutils-2.36.1 on Debian-11.5/amd64.
gcc/config/h8300/t-h8300 is modified with:
MULTILIB_OPTIONS = ms/msx mint32
MULTILIB_DIRNAMES = h8300s h8sx int32
to disable building H8 normal mode library.
gcc configuration is:
../configure --target=h8300-unknown-elf --enable-languages=c,c++ \
--prefix=/home/uaa/h8300 --with-newlib --disable-nls --disable-libssp \
--disable-libgomp --disable-libstdcxx-pch \
--disable-libstdcxx-filesystem-ts --with-newlib --disable-wchar_t
include/demangle.h related warning occurs cross-compiled cp-demangle.c,
due to the size of int is 16bit (H8/300 default).
bin/bash ../libtool --tag CC --tag disable-shared --mode=compile
/home/uaa/gcc-12.2.0/h8300-unknown-elf/./gcc/xgcc
-B/home/uaa/gcc-12.2.0/h8300-unknown-elf/./gcc/ -nostdinc
-B/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/newlib/ -isystem
/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/newlib/targ-include
-isystem /home/uaa/gcc-12.2.0/newlib/libc/include
-B/home/uaa/h8300/h8300-unknown-elf/bin/
-B/home/uaa/h8300/h8300-unknown-elf/lib/ -isystem
/home/uaa/h8300/h8300-unknown-elf/include -isystem
/home/uaa/h8300/h8300-unknown-elf/sys-include -DHAVE_CONFIG_H -I..
-I/home/uaa/gcc-12.2.0/libstdc++-v3/../libiberty
-I/home/uaa/gcc-12.2.0/libstdc++-v3/../include
-I/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/libstdc++-v3/include/h8300-unknown-elf
-I/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/libstdc++-v3/include
-I/home/uaa/gcc-12.2.0/libstdc++-v3/libsupc++ -g -O2 -DIN_GLIBCPP_V3
-Wno-error -c cp-demangle.c
libtool: compile: /home/uaa/gcc-12.2.0/h8300-unknown-elf/./gcc/xgcc
-B/home/uaa/gcc-12.2.0/h8300-unknown-elf/./gcc/ -nostdinc
-B/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/newlib/ -isystem
/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/newlib/targ-include
-isystem /home/uaa/gcc-12.2.0/newlib/libc/include
-B/home/uaa/h8300/h8300-unknown-elf/bin/
-B/home/uaa/h8300/h8300-unknown-elf/lib/ -isystem
/home/uaa/h8300/h8300-unknown-elf/include -isystem
/home/uaa/h8300/h8300-unknown-elf/sys-include -DHAVE_CONFIG_H -I..
-I/home/uaa/gcc-12.2.0/libstdc++-v3/../libiberty
-I/home/uaa/gcc-12.2.0/libstdc++-v3/../include
-I/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/libstdc++-v3/include/h8300-unknown-elf
-I/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/libstdc++-v3/include
-I/home/uaa/gcc-12.2.0/libstdc++-v3/libsupc++ -g -O2 -DIN_GLIBCPP_V3 -Wno-error
-c cp-demangle.c -o cp-demangle.o
In file included from cp-demangle.c:139:
/home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:58:29: warning:
left shift count >= width of type [-Wshift-count-overflow]
58 | #define DMGL_DLANG (1 << 16)
| ^~
/home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:91:22: note: in
expansion of macro 'DMGL_DLANG'
91 | dlang_demangling = DMGL_DLANG,
| ^~~~~~~~~~
/home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:59:29: warning:
left shift count >= width of type [-Wshift-count-overflow]
59 | #define DMGL_RUST (1 << 17) /* Rust wraps GNU_V3 style
mangling. */
| ^~
/home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:92:21: note: in
expansion of macro 'DMGL_RUST'
92 | rust_demangling = DMGL_RUST
| ^~~~~~~~~
cp-demangle.c: In function 'd_function_type':
/home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:68:34: warning:
left shift count >= width of type [-Wshift-count-overflow]
68 | #define DMGL_NO_RECURSE_LIMIT (1 << 18)
| ^~
cp-demangle.c:2891:22: note: in expansion of macro 'DMGL_NO_RECURSE_LIMIT'
2891 | if ((di->options & DMGL_NO_RECURSE_LIMIT) == 0)
| ^~~~~~~~~~~~~~~~~~~~~
/home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:68:34: warning:
left shift count >= width of type [-Wshift-count-overflow]
68 | #define DMGL_NO_RECURSE_LIMIT (1 << 18)
| ^~
cp-demangle.c:2916:22: note: in expansion of macro 'DMGL_NO_RECURSE_LIMIT'
2916 | if ((di->options & DMGL_NO_RECURSE_LIMIT) == 0)
| ^~~~~~~~~~~~~~~~~~~~~
cp-demangle.c: In function 'd_demangle_callback':
/home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:68:34: warning:
left shift count >= width of type [-Wshift-count-overflow]
68 | #define DMGL_NO_RECURSE_LIMIT (1 << 18)
| ^~
cp-demangle.c:6448:19: note: in expansion of macro 'DMGL_NO_RECURSE_LIMIT'
6448 | if (((options & DMGL_NO_RECURSE_LIMIT) == 0)
| ^~~~~~~~~~~~~~~~~~~~~
suggested remedy is attached.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug demangler/107884] H8/300: cp-demangle.c fix warning related demangle.h
2022-11-26 23:16 [Bug libstdc++/107884] New: H8/300: cp-demangle.c fix warning related demangle.h uaa at mx5 dot nisiq.net
@ 2022-11-27 0:19 ` pinskia at gcc dot gnu.org
2022-11-27 9:35 ` uaa at mx5 dot nisiq.net
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-27 0:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107884
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The patch does not work as you cannot pack bit options like this.
There needs to be some better way of doing this.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug demangler/107884] H8/300: cp-demangle.c fix warning related demangle.h
2022-11-26 23:16 [Bug libstdc++/107884] New: H8/300: cp-demangle.c fix warning related demangle.h uaa at mx5 dot nisiq.net
2022-11-27 0:19 ` [Bug demangler/107884] " pinskia at gcc dot gnu.org
@ 2022-11-27 9:35 ` uaa at mx5 dot nisiq.net
2022-11-28 7:44 ` rguenth at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: uaa at mx5 dot nisiq.net @ 2022-11-27 9:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107884
--- Comment #2 from SASANO Takayoshi <uaa at mx5 dot nisiq.net> ---
Hello, can you tell me more details to do?
I think "some better way" seems to be one of them as follows.
1) change "#if __INT_WIDTH__ > 16 ~ #else ~ #endif" to
"#if defined(__INT_WIDTH__) && (__INT_WIDTH__ <= 16) ~ #else ~ #endif"
to safer choice.
2) remove "#define DMGL_OPT_BIT(x)", all "#define DMGL_..." uses (1 << x).
3) abandon remap bit position for int=16bit architecture,
modify codes that can pass 32bit-value option.
4) others (I have no idea...)
please tell me.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug demangler/107884] H8/300: cp-demangle.c fix warning related demangle.h
2022-11-26 23:16 [Bug libstdc++/107884] New: H8/300: cp-demangle.c fix warning related demangle.h uaa at mx5 dot nisiq.net
2022-11-27 0:19 ` [Bug demangler/107884] " pinskia at gcc dot gnu.org
2022-11-27 9:35 ` uaa at mx5 dot nisiq.net
@ 2022-11-28 7:44 ` rguenth at gcc dot gnu.org
2022-11-28 9:13 ` redi at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-11-28 7:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107884
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jsm28 at gcc dot gnu.org
Target| |h8
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Since there is I think no ABI constraints here simply using the appearant
unused bits to get them to fit into 16 bits looks possible?
Supposedly C defines literal suffixes for int32_t? Otherwise using (1L << 17)
might work as well here.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug demangler/107884] H8/300: cp-demangle.c fix warning related demangle.h
2022-11-26 23:16 [Bug libstdc++/107884] New: H8/300: cp-demangle.c fix warning related demangle.h uaa at mx5 dot nisiq.net
` (2 preceding siblings ...)
2022-11-28 7:44 ` rguenth at gcc dot gnu.org
@ 2022-11-28 9:13 ` redi at gcc dot gnu.org
2022-11-28 11:37 ` redi at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-28 9:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107884
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> Supposedly C defines literal suffixes for int32_t? Otherwise using (1L <<
> 17) might work as well here.
Yes, it could be:
INT32_C(1) << 17
That expands to int_least32_t not int32_t but that's fine for this purpose.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug demangler/107884] H8/300: cp-demangle.c fix warning related demangle.h
2022-11-26 23:16 [Bug libstdc++/107884] New: H8/300: cp-demangle.c fix warning related demangle.h uaa at mx5 dot nisiq.net
` (3 preceding siblings ...)
2022-11-28 9:13 ` redi at gcc dot gnu.org
@ 2022-11-28 11:37 ` redi at gcc dot gnu.org
2022-11-29 12:29 ` uaa at mx5 dot nisiq.net
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-28 11:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107884
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oh, except that we pass it to cplus_demangle(const char*, int) and so anything
above the first 16 bits is lost anyway. Should that function use int32_t
instead?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug demangler/107884] H8/300: cp-demangle.c fix warning related demangle.h
2022-11-26 23:16 [Bug libstdc++/107884] New: H8/300: cp-demangle.c fix warning related demangle.h uaa at mx5 dot nisiq.net
` (4 preceding siblings ...)
2022-11-28 11:37 ` redi at gcc dot gnu.org
@ 2022-11-29 12:29 ` uaa at mx5 dot nisiq.net
2023-01-05 13:56 ` redi at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: uaa at mx5 dot nisiq.net @ 2022-11-29 12:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107884
--- Comment #6 from SASANO Takayoshi <uaa at mx5 dot nisiq.net> ---
Created attachment 53980
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53980&action=edit
rewrite int options -> int32_t options
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug demangler/107884] H8/300: cp-demangle.c fix warning related demangle.h
2022-11-26 23:16 [Bug libstdc++/107884] New: H8/300: cp-demangle.c fix warning related demangle.h uaa at mx5 dot nisiq.net
` (5 preceding siblings ...)
2022-11-29 12:29 ` uaa at mx5 dot nisiq.net
@ 2023-01-05 13:56 ` redi at gcc dot gnu.org
2023-02-24 15:25 ` mike at mnmoran dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-05 13:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107884
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-01-05
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug demangler/107884] H8/300: cp-demangle.c fix warning related demangle.h
2022-11-26 23:16 [Bug libstdc++/107884] New: H8/300: cp-demangle.c fix warning related demangle.h uaa at mx5 dot nisiq.net
` (6 preceding siblings ...)
2023-01-05 13:56 ` redi at gcc dot gnu.org
@ 2023-02-24 15:25 ` mike at mnmoran dot org
2023-02-24 15:30 ` mike at mnmoran dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mike at mnmoran dot org @ 2023-02-24 15:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107884
Michael N. Moran <mike at mnmoran dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mike at mnmoran dot org
--- Comment #7 from Michael N. Moran <mike at mnmoran dot org> ---
Created attachment 54530
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54530&action=edit
Assembler file produced from cp-demangle.c
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug demangler/107884] H8/300: cp-demangle.c fix warning related demangle.h
2022-11-26 23:16 [Bug libstdc++/107884] New: H8/300: cp-demangle.c fix warning related demangle.h uaa at mx5 dot nisiq.net
` (7 preceding siblings ...)
2023-02-24 15:25 ` mike at mnmoran dot org
@ 2023-02-24 15:30 ` mike at mnmoran dot org
2023-02-26 12:34 ` uaa at mx5 dot nisiq.net
2023-02-26 14:58 ` mike at mnmoran dot org
10 siblings, 0 replies; 12+ messages in thread
From: mike at mnmoran dot org @ 2023-02-24 15:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107884
--- Comment #8 from Michael N. Moran <mike at mnmoran dot org> ---
I tried to build with after patching with
https://gcc.gnu.org/bugzilla/attachment.cgi?id=53980 and now get an assembler
failure.
/tmp/cc2C1wMh.s: Assembler messages:
/tmp/cc2C1wMh.s:82060: Error: value of 00012570 too large for field of 2 bytes
at 00000002
I created a corresponding cp-demangle.s file and attached it
https://gcc.gnu.org/bugzilla/attachment.cgi?id=54530
The offending line looks like this:
.Ldebug_line0:
.2byte 0, .LELT0-.LSLT0 <<<<<< line 82060
.LSLT0:
.2byte 0x5
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug demangler/107884] H8/300: cp-demangle.c fix warning related demangle.h
2022-11-26 23:16 [Bug libstdc++/107884] New: H8/300: cp-demangle.c fix warning related demangle.h uaa at mx5 dot nisiq.net
` (8 preceding siblings ...)
2023-02-24 15:30 ` mike at mnmoran dot org
@ 2023-02-26 12:34 ` uaa at mx5 dot nisiq.net
2023-02-26 14:58 ` mike at mnmoran dot org
10 siblings, 0 replies; 12+ messages in thread
From: uaa at mx5 dot nisiq.net @ 2023-02-26 12:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107884
--- Comment #9 from SASANO Takayoshi <uaa at mx5 dot nisiq.net> ---
(In reply to Michael N. Moran from comment #8)
> I created a corresponding cp-demangle.s file and attached it
> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54530
Please read this thread carefully, currently this issue targets
H8 advanced mode (24bit address). Your attachment says that
the code is compiled for H8 normal mode (16bit address).
> .file "cp-demangle.c"
> .h8300hn
> .section .text
But, we have to consider why the problem has occurred.
> .Ldebug_ranges3:
> .section .debug_line,"",@progbits
> .Ldebug_line0:
> .2byte 0, .LELT0-.LSLT0
> .LSLT0:
> .2byte 0x5
(snip)
>
> .byte 0x1
> .LELT0:
> .section .debug_str,"MS",@progbits,1
> .LASF248:
(.LELT0 - .LSLT0) shows the size of .debug_line section.
The reported problem means "allocated bitwidth for .Ldebug_line0
is insufficient to store the size of .debug_line section".
I think this is out of topic, should be handled at more suitable place.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug demangler/107884] H8/300: cp-demangle.c fix warning related demangle.h
2022-11-26 23:16 [Bug libstdc++/107884] New: H8/300: cp-demangle.c fix warning related demangle.h uaa at mx5 dot nisiq.net
` (9 preceding siblings ...)
2023-02-26 12:34 ` uaa at mx5 dot nisiq.net
@ 2023-02-26 14:58 ` mike at mnmoran dot org
10 siblings, 0 replies; 12+ messages in thread
From: mike at mnmoran dot org @ 2023-02-26 14:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107884
--- Comment #10 from Michael N. Moran <mike at mnmoran dot org> ---
(In reply to SASANO Takayoshi from comment #9)
> (In reply to Michael N. Moran from comment #8)
> > I created a corresponding cp-demangle.s file and attached it
> > https://gcc.gnu.org/bugzilla/attachment.cgi?id=54530
>
> Please read this thread carefully, currently this issue targets
> H8 advanced mode (24bit address). Your attachment says that
> the code is compiled for H8 normal mode (16bit address).
>
> > .file "cp-demangle.c"
> > .h8300hn
> > .section .text
>
Indeed. It has been a long time since I looked a all of the modes for the
H8/300.
> But, we have to consider why the problem has occurred.
>
> > .Ldebug_ranges3:
> > .section .debug_line,"",@progbits
> > .Ldebug_line0:
> > .2byte 0, .LELT0-.LSLT0
> > .LSLT0:
> > .2byte 0x5
> (snip)
> >
> > .byte 0x1
> > .LELT0:
> > .section .debug_str,"MS",@progbits,1
> > .LASF248:
>
> (.LELT0 - .LSLT0) shows the size of .debug_line section.
>
> The reported problem means "allocated bitwidth for .Ldebug_line0
> is insufficient to store the size of .debug_line section".
>
> I think this is out of topic, should be handled at more suitable place.
Yes, I divined this later and, after a lot of trial-and-error with various
configuration options, found a configure incantation that seems to work.
Among other things, this configuration used --disable-hosted-libstdcxx, which
prevented the use of `cp-demangle.c` in the build.
configure --target=h8300-none-elf --with-newlib
--disable-newlib-supplied-syscalls --enable-languages=c,c++,lto
--with-libstdcxx-zoneinfo=n --disable-shared --disable-__cxa_atexit
--disable-libstdcxx-verbose --disable-hosted-libstdcxx --disable-libstdcxx-pch
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2023-02-26 14:58 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-26 23:16 [Bug libstdc++/107884] New: H8/300: cp-demangle.c fix warning related demangle.h uaa at mx5 dot nisiq.net
2022-11-27 0:19 ` [Bug demangler/107884] " pinskia at gcc dot gnu.org
2022-11-27 9:35 ` uaa at mx5 dot nisiq.net
2022-11-28 7:44 ` rguenth at gcc dot gnu.org
2022-11-28 9:13 ` redi at gcc dot gnu.org
2022-11-28 11:37 ` redi at gcc dot gnu.org
2022-11-29 12:29 ` uaa at mx5 dot nisiq.net
2023-01-05 13:56 ` redi at gcc dot gnu.org
2023-02-24 15:25 ` mike at mnmoran dot org
2023-02-24 15:30 ` mike at mnmoran dot org
2023-02-26 12:34 ` uaa at mx5 dot nisiq.net
2023-02-26 14:58 ` mike at mnmoran 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).