[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Trying to track down problem with packed.com from testsuite
From: |
Gaius Mulley |
Subject: |
Re: Trying to track down problem with packed.com from testsuite |
Date: |
Fri, 30 Aug 2024 11:26:01 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
john o goyo <jog37@riddermarkfarm.ca> writes:
> Greetings, Gaius.
>
> On 2024-08-11 14:30, Gaius Mulley wrote:
>> john o goyo <jog37@riddermarkfarm.ca> writes:
>>
>>> Greetings, Gaius.
>>>
>>> Here is an oddity:
>>>
>>> [~/opt/gm2/testsuite]=> gm2-14 -c -O -fomit-frame-pointer
>>> -finline-functions -fiso packed.mod
>>> [~/opt/gm2/testsuite]=> gm2-14 -c -O0 -fomit-frame-pointer
>>> -finline-functions -fiso packed.mod
>>> [~/opt/gm2/testsuite]=> gm2-14 -c -O1 -fomit-frame-pointer
>>> -finline-functions -fiso packed.mod
>>> [~/opt/gm2/testsuite]=> gm2-14 -c -O2 -fomit-frame-pointer
>>> -finline-functions -fiso packed.mod
>>> gm2: internal compiler error: Segmentation Fault signal terminated
>>> program cc1gm2
>>> Please submit a full bug report, with preprocessed source (by using
>>> -freport-bug).
>>> See <https://gcc.gnu.org/bugs/> for instructions.
>>> [~/opt/gm2/testsuite]=> gm2-14 -c -Ofast -fomit-frame-pointer
>>> -finline-functions -fiso packed.mod
>>> gm2: internal compiler error: Segmentation Fault signal terminated
>>> program cc1gm2
>>> Please submit a full bug report, with preprocessed source (by using
>>> -freport-bug).
>>> See <https://gcc.gnu.org/bugs/> for instructions.
>>>
>>> Basically, optimisation level 2 and above causes problems.
>>>
>>> I am trying to chase down the problem but I have clue where the gm2
>>> compilation starts. Please inform me on which function to break.
>>>
>>> Sincerely,
>>> john
>> Hi John,
>>
>> that is an interesting observation.
>>
>> One way to debug is to set a break point on:
>> gimplify_function_tree(tree_node*)
>>
>> which is called by the front end at each end of function when the
>> statement tree is complete. The statement tree can be dumped as follows
>> below. For small test programs this can be useful - even to see which
>> function causes the sigsegv.
>
> Perhaps I am missing something but how do I set a breakpoint on
> something in cc1gm2? Does it not read files produced by gcc?
>
> I tried loading the core file but no backtrace available, as seen below.
>
> % gdb
> /home/build/gcc/14.2.0/libexec/gcc/sparc-sun-solaris2.11/14.2.0/cc1gm2
> core
> GNU gdb (GDB) 15.1
> [...]
> Reading symbols from
> /home/build/gcc/14.2.0/libexec/gcc/sparc-sun-solaris2.11/14.2.0/cc1gm2...
> [New LWP 1]
> Cannot access memory at address 0x1c
> Cannot access memory at address 0x18
> Cannot access memory at address 0x18
> Core was generated by
> `/home/build/gcc/14.1.0/libexec/gcc/sparc-sun-solaris2.11/14.1.0/cc1gm2
> -quiet -'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0 0xffbff4fc in ?? ()
> (gdb) bt
> #0 0xffbff4fc in ?? ()
> #1 0x00665e1c in alloc_page (order=0) at
> /home/build/opt/gcc/src/gcc-14.2.0/gcc/ggc-page.cc:805
> #2 ggc_internal_alloc (size=<optimized out>, f=0xffbfe888,
> s=4290766288, n=4170231808)
> at /home/build/opt/gcc/src/gcc-14.2.0/gcc/ggc-page.cc:1295
> Backtrace stopped: previous frame identical to this frame (corrupt stack?)
>
> Sincerely,
> john
Hi John,
Does the following work on Solaris with gdb, it will invoke cc1gm2
with all default options and the source file hello.mod.
$ gm2 hello.mod -wrapper gdb,--args
GNU gdb (Debian 13.1-3) 13.1
Copyright (C) 2023 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-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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"...
Reading symbols from
/home/gaius/opt/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/cc1gm2...
(gdb) break gimplify_function_tree(tree_node*)
Breakpoint 1 at 0xe52080: file ../../gcc/tree.h, line 3632.
(gdb) run
Starting program: /home/gaius/opt/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/cc1gm2
-imultiarch x86_64-linux-gnu -quiet -dumpdir a- -dumpbase hello.mod
-dumpbase-ext .mod -mtune=generic -march=x86-64 -g -fm2-pathname=-
-fm2-pathnameI. -fgen-module-list=- -fscaffold-dynamic -fscaffold-main
-flibs=m2cor,m2log,m2pim,m2iso -fm2-pathname=- -fm2-pathnameI. hello.mod -o
/tmp/ccQdbK7K.s
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, gimplify_function_tree (fndecl=0x7ffff76cc300) at
../../gcc/tree.h:3632
3632 if (TREE_CODE (__t) != __c)
(gdb)
If this feature doesn't work then you could add the two lines:
break gimplify_function_tree(tree_node*)
run -imultiarch x86_64-linux-gnu -quiet -dumpdir a- -dumpbase hello.mod \
-dumpbase-ext .mod -mtune=generic -march=x86-64 -g -fm2-pathname=- \
-fm2-pathnameI. -fgen-module-list=- -fscaffold-dynamic -fscaffold-main \
-flibs=m2cor,m2log,m2pim,m2iso -fm2-pathname=- -fm2-pathnameI. hello.mod \
-o hello.s
[ ie the command args specified in your Starting program line above, or
if -wrapper doesn't work, use gm2 -v hello.mod ].
to the end of gcc-source/gcc/gdbinit.in and then change directory to the
top build dir.
$ cd gcc
$ gdb cc1gm2
which will have the same effect, hope this helps
regards,
Gaius