public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1791] c: Fix up c_parser_has_attribute_expression [PR101176]
Date: Thu, 24 Jun 2021 13:58:41 +0000 (GMT)	[thread overview]
Message-ID: <20210624135841.23979385DC33@sourceware.org> (raw)

https://gcc.gnu.org/g:178fb8df9315f2f8f45b7fe5faf11a9c2912cc28

commit r12-1791-g178fb8df9315f2f8f45b7fe5faf11a9c2912cc28
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jun 24 15:58:02 2021 +0200

    c: Fix up c_parser_has_attribute_expression [PR101176]
    
    This function keeps src_range member of the result uninitialized, which at
    least under valgrind can show up later when those uninitialized location_t's
    can make it into the IL or location_t hash tables.
    
    2021-06-24  Jakub Jelinek  <jakub@redhat.com>
    
            PR c/101176
            * c-parser.c (c_parser_has_attribute_expression): Set source range for
            the result.

Diff:
---
 gcc/c/c-parser.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index c0f702049bb..27034f88f49 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -8406,6 +8406,7 @@ c_parser_has_attribute_expression (c_parser *parser)
 {
   gcc_assert (c_parser_next_token_is_keyword (parser,
 					      RID_BUILTIN_HAS_ATTRIBUTE));
+  location_t start = c_parser_peek_token (parser)->location;
   c_parser_consume_token (parser);
 
   c_inhibit_evaluation_warnings++;
@@ -8484,6 +8485,7 @@ c_parser_has_attribute_expression (c_parser *parser)
 
   parser->translate_strings_p = save_translate_strings_p;
 
+  location_t finish = c_parser_peek_token (parser)->location;
   if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
     c_parser_consume_token (parser);
   else
@@ -8512,6 +8514,7 @@ c_parser_has_attribute_expression (c_parser *parser)
   else
     result.value =  boolean_false_node;
 
+  set_c_expr_source_range (&result, start, finish);
   return result;
 }


                 reply	other threads:[~2021-06-24 13:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210624135841.23979385DC33@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).