* [PATCH] Avoid emitting "sizetype" type names into .debug_info (PR debug/80263)
@ 2017-04-01 12:27 Jakub Jelinek
2017-04-03 11:11 ` Pedro Alves
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2017-04-01 12:27 UTC (permalink / raw)
To: Jason Merrill; +Cc: gcc-patches
Hi!
This PR is about debug info containing the artificial "sizetype" type
as name of a DW_TAG_base_type, which can clash with user sizetype
identifiers etc.
Apparently we already have code that attempts to not expose that type,
but only do that if sizetype has TYPE_DECL as TYPE_NAME and that denotes
some other, standard, type.
The following patch extends it to attempt to emit size_type_node name
instead of "sizetype" if both sizetype and size_type_node have the
same precision and signedness.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2017-04-01 Jakub Jelinek <jakub@redhat.com>
PR debug/80263
* dwarf2out.c (modified_type_die): Try harder not to emit internal
sizetype type into debug info.
* gcc.dg/debug/dwarf2/pr80263.c: New test.
--- gcc/dwarf2out.c.jj 2017-03-31 20:39:54.000000000 +0200
+++ gcc/dwarf2out.c 2017-04-01 11:24:50.319288819 +0200
@@ -12464,20 +12464,29 @@ modified_type_die (tree type, int cv_qua
this type. */
qualified_type = get_qualified_type (type, cv_quals);
- if (qualified_type == sizetype
- && TYPE_NAME (qualified_type)
- && TREE_CODE (TYPE_NAME (qualified_type)) == TYPE_DECL)
+ if (qualified_type == sizetype)
{
- tree t = TREE_TYPE (TYPE_NAME (qualified_type));
+ /* Try not to expose the internal sizetype type's name. */
+ if (TYPE_NAME (qualified_type)
+ && TREE_CODE (TYPE_NAME (qualified_type)) == TYPE_DECL)
+ {
+ tree t = TREE_TYPE (TYPE_NAME (qualified_type));
- gcc_checking_assert (TREE_CODE (t) == INTEGER_TYPE
- && TYPE_PRECISION (t)
- == TYPE_PRECISION (qualified_type)
- && TYPE_UNSIGNED (t)
- == TYPE_UNSIGNED (qualified_type));
- qualified_type = t;
+ gcc_checking_assert (TREE_CODE (t) == INTEGER_TYPE
+ && (TYPE_PRECISION (t)
+ == TYPE_PRECISION (qualified_type))
+ && (TYPE_UNSIGNED (t)
+ == TYPE_UNSIGNED (qualified_type)));
+ qualified_type = t;
+ }
+ else if (qualified_type == sizetype
+ && TREE_CODE (sizetype) == TREE_CODE (size_type_node)
+ && TYPE_PRECISION (sizetype) == TYPE_PRECISION (size_type_node)
+ && TYPE_UNSIGNED (sizetype) == TYPE_UNSIGNED (size_type_node))
+ qualified_type = size_type_node;
}
+
/* If we do, then we can just use its DIE, if it exists. */
if (qualified_type)
{
--- gcc/testsuite/gcc.dg/debug/dwarf2/pr80263.c.jj 2017-04-01 11:29:32.648668616 +0200
+++ gcc/testsuite/gcc.dg/debug/dwarf2/pr80263.c 2017-04-01 11:31:42.954996922 +0200
@@ -0,0 +1,7 @@
+/* PR debug/80263 */
+/* { dg-do compile } */
+/* { dg-options "-g -dA" } */
+
+char array[1];
+
+/* { dg-final { scan-assembler-not {\msizetype} } } */
Jakub
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Avoid emitting "sizetype" type names into .debug_info (PR debug/80263)
2017-04-01 12:27 [PATCH] Avoid emitting "sizetype" type names into .debug_info (PR debug/80263) Jakub Jelinek
@ 2017-04-03 11:11 ` Pedro Alves
2017-04-03 11:31 ` Pedro Alves
0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2017-04-03 11:11 UTC (permalink / raw)
To: Jakub Jelinek, Jason Merrill; +Cc: gcc-patches
Hi Jakub,
On 04/01/2017 01:27 PM, Jakub Jelinek wrote:
> 2017-04-01 Jakub Jelinek <jakub@redhat.com>
>
> PR debug/80263
> * dwarf2out.c (modified_type_die): Try harder not to emit internal
> sizetype type into debug info.
>
> * gcc.dg/debug/dwarf2/pr80263.c: New test.
Thanks much for the fix.
I've run gdb's testsuite against GCC trunk with this patch,
and found no regressions.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Avoid emitting "sizetype" type names into .debug_info (PR debug/80263)
2017-04-03 11:11 ` Pedro Alves
@ 2017-04-03 11:31 ` Pedro Alves
0 siblings, 0 replies; 3+ messages in thread
From: Pedro Alves @ 2017-04-03 11:31 UTC (permalink / raw)
To: Jakub Jelinek, Jason Merrill; +Cc: gcc-patches
On 04/03/2017 12:11 PM, Pedro Alves wrote:
> Hi Jakub,
>
> On 04/01/2017 01:27 PM, Jakub Jelinek wrote:
>
>> 2017-04-01 Jakub Jelinek <jakub@redhat.com>
>>
>> PR debug/80263
>> * dwarf2out.c (modified_type_die): Try harder not to emit internal
>> sizetype type into debug info.
>>
>> * gcc.dg/debug/dwarf2/pr80263.c: New test.
>
> Thanks much for the fix.
>
> I've run gdb's testsuite against GCC trunk with this patch,
> and found no regressions.
Oh, and I forgot to mention for the archives that I had
confirmed that the testcase at:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80263#c1
starts working correctly with this patch too.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-03 11:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-01 12:27 [PATCH] Avoid emitting "sizetype" type names into .debug_info (PR debug/80263) Jakub Jelinek
2017-04-03 11:11 ` Pedro Alves
2017-04-03 11:31 ` Pedro Alves
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).