public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug compile/18202] New: [compile] cv-qualified self-references crash
@ 2015-04-05 13:59 jan.kratochvil at redhat dot com
2015-04-10 12:18 ` [Bug compile/18202] " jan.kratochvil at redhat dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2015-04-05 13:59 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=18202
Bug ID: 18202
Summary: [compile] cv-qualified self-references crash
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: compile
Assignee: unassigned at sourceware dot org
Reporter: jan.kratochvil at redhat dot com
Created attachment 8225
--> https://sourceware.org/bugzilla/attachment.cgi?id=8225&action=edit
reproducer for GDB
gdb/testsuite/gdb.compile/compile.c
struct struct_type {
- struct struct_type *selffield;
+ volatile struct struct_type *selffield;
->
compile code struct_object.selffield = &struct_object
gdb command line:1:1: internal compiler error: Segmentation fault
This is because selffield has !COMPLETE_TYPE_P as at that time struct
struct_type is not yet complete and the cv-qualifier creates a copy (not
reference) of the type inside GCC.
I guess cv-qualified self-references will need to create opaque type inside
GCC.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug compile/18202] [compile] cv-qualified self-references crash
2015-04-05 13:59 [Bug compile/18202] New: [compile] cv-qualified self-references crash jan.kratochvil at redhat dot com
@ 2015-04-10 12:18 ` jan.kratochvil at redhat dot com
2015-05-16 12:43 ` cvs-commit at gcc dot gnu.org
2015-09-20 20:56 ` jan.kratochvil at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2015-04-10 12:18 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=18202
Jan Kratochvil <jan.kratochvil at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jan.kratochvil at redhat dot com
--- Comment #1 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
Simplified/standalone reproducer:
cat >1.c <<EOH
// b tree.c:build_qualified_type
// p TYPE_SIZE (type)
volatile struct sv { volatile struct sv *p; } sv; // CRASH: compile code sv.p =
&sv;
volatile struct s { int i; } s, *sp; // OK: compile code sp = &s;
int main(void) { return 0; }
EOH
gcc -o 1 1.c -Wall -g; gdb ./1 -ex start -ex 'compile code sv.p = &sv'
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug compile/18202] [compile] cv-qualified self-references crash
2015-04-05 13:59 [Bug compile/18202] New: [compile] cv-qualified self-references crash jan.kratochvil at redhat dot com
2015-04-10 12:18 ` [Bug compile/18202] " jan.kratochvil at redhat dot com
@ 2015-05-16 12:43 ` cvs-commit at gcc dot gnu.org
2015-09-20 20:56 ` jan.kratochvil at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-05-16 12:43 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=18202
--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jan Kratochvil <jkratoch@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3a9558c494e9b461f752ce26382701d4446f0958
commit 3a9558c494e9b461f752ce26382701d4446f0958
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Sat May 16 14:20:45 2015 +0200
compile: Use -Wall, not -w
For a reason unknown to me GDB was using -w instead of -Wall for 'compile
code'.
The problem is later patch for 'compile printf' really needs some warnings
to
be able to catch for example missing format string parameters:
(gdb) compile printf "%d\n"
GCC does not seem to be able to cancel -w (there is nothing like -no-w).
Besides that I think even 'compile code' can benefit from -Wall.
That #ifndef change in print_one_macro() is needed otherwise we get
macro-redefinition warnings for the GCC built-in macros (as -w is no
longer in effect). For example, without the #ifndef/#endif one gets:
compile -r -- void _gdb_expr(){int i = 5;}^M
/tmp/gdbobj-xpU1yB/out4.c:4:0: warning: "__FILE__" redefined
[-Wbuiltin-macro-redefined]^M
/tmp/gdbobj-xpU1yB/out4.c:5:0: warning: "__LINE__" redefined^M
...
It makes more sense to pick the inferior's version of the macros, hence
#ifndef instead of #undef.
That new testsuite XFAIL is there as if one changes the struct definition
to be
compliant with cv-qualifiers (to prevent the warnings):
struct struct_type {
- struct struct_type *selffield;
+ volatile struct struct_type *selffield;
only then GCC/GDB will hit the crash, described in that GDB PR 18202.
gdb/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile-c-support.c (print_one_macro): Use #ifndef.
(generate_register_struct): Use __gdb_uintptr for TYPE_CODE_PTR.
(c_compute_program): Call generate_register_struct after typedefs.
* compile/compile-loc2c.c (push, pushf_register_address)
(pushf_register): Cast to GCC_UINTPTR.
(do_compile_dwarf_expr_to_c): Use unused attribute. Add space after
type. Use GCC_UINTPTR instead of void *. Remove excessive cast.
(compile_dwarf_expr_to_c): Use GCC_UINTPTR instead of void *.
* compile/compile.c (_initialize_compile): Enable warnings for
COMPILE_ARGS.
gdb/testsuite/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.compile/compile-ops.exp: Cast param to void.
* gdb.compile/compile.exp: Complete type for _gdb_expr.
(compile code struct_object.selffield = &struct_object): Add xfail.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug compile/18202] [compile] cv-qualified self-references crash
2015-04-05 13:59 [Bug compile/18202] New: [compile] cv-qualified self-references crash jan.kratochvil at redhat dot com
2015-04-10 12:18 ` [Bug compile/18202] " jan.kratochvil at redhat dot com
2015-05-16 12:43 ` cvs-commit at gcc dot gnu.org
@ 2015-09-20 20:56 ` jan.kratochvil at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2015-09-20 20:56 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=18202
Jan Kratochvil <jan.kratochvil at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |7.10
--- Comment #3 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
This has been primarily fixed in GCC.
But some commit was done also for GDB-7.10:
https://sourceware.org/ml/gdb-patches/2015-07/msg00204.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-20 20:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-05 13:59 [Bug compile/18202] New: [compile] cv-qualified self-references crash jan.kratochvil at redhat dot com
2015-04-10 12:18 ` [Bug compile/18202] " jan.kratochvil at redhat dot com
2015-05-16 12:43 ` cvs-commit at gcc dot gnu.org
2015-09-20 20:56 ` jan.kratochvil at redhat dot com
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).