public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] opts: do not do sanity check when an error is seen
@ 2021-12-16 14:37 Martin Liška
  2021-12-16 16:44 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Liška @ 2021-12-16 14:37 UTC (permalink / raw)
  To: gcc-patches

Do not check global options modification when an error is seen in parsing
of options (pragmas or attributes).

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

	PR target/103709

gcc/c-family/ChangeLog:

	* c-pragma.c (handle_pragma_pop_options): Do not check
	global options modification when an error is seen in parsing
	of options (pragmas or attributes).
---
  gcc/c-family/c-pragma.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c
index c4ed4205820..0772c34342a 100644
--- a/gcc/c-family/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -1132,7 +1132,7 @@ handle_pragma_pop_options (cpp_reader *ARG_UNUSED(dummy))
  				      p->optimize_binary);
        optimization_current_node = p->optimize_binary;
      }
-  if (flag_checking)
+  if (flag_checking && !seen_error ())
      {
        cl_optimization_compare (p->saved_global_options, &global_options);
        free (p->saved_global_options);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] opts: do not do sanity check when an error is seen
  2021-12-16 14:37 [PATCH] opts: do not do sanity check when an error is seen Martin Liška
@ 2021-12-16 16:44 ` Jeff Law
  2022-01-12 11:52   ` Martin Liška
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2021-12-16 16:44 UTC (permalink / raw)
  To: Martin Liška, gcc-patches



On 12/16/2021 7:37 AM, Martin Liška wrote:
> Do not check global options modification when an error is seen in parsing
> of options (pragmas or attributes).
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
> Thanks,
> Martin
>
>     PR target/103709
>
> gcc/c-family/ChangeLog:
>
>     * c-pragma.c (handle_pragma_pop_options): Do not check
>     global options modification when an error is seen in parsing
>     of options (pragmas or attributes).
OK
jeff


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] opts: do not do sanity check when an error is seen
  2021-12-16 16:44 ` Jeff Law
@ 2022-01-12 11:52   ` Martin Liška
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Liška @ 2022-01-12 11:52 UTC (permalink / raw)
  To: Jeff Law, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 674 bytes --]

On 12/16/21 17:44, Jeff Law wrote:
> 
> 
> On 12/16/2021 7:37 AM, Martin Liška wrote:
>> Do not check global options modification when an error is seen in parsing
>> of options (pragmas or attributes).
>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>
>> Ready to be installed?
>> Thanks,
>> Martin
>>
>>     PR target/103709
>>
>> gcc/c-family/ChangeLog:
>>
>>     * c-pragma.c (handle_pragma_pop_options): Do not check
>>     global options modification when an error is seen in parsing
>>     of options (pragmas or attributes).
> OK
> jeff
> 

The following patch handled the same for attributes.

Pushed as obvious.
Martin

[-- Attachment #2: 0001-opts-do-not-do-sanity-check-when-an-error-is-seen.patch --]
[-- Type: text/x-patch, Size: 962 bytes --]

From 98b5359b474e4de89ebc1ea5203ca907738f7d7f Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Wed, 12 Jan 2022 12:48:33 +0100
Subject: [PATCH] opts: do not do sanity check when an error is seen

	PR target/103804

gcc/c-family/ChangeLog:

	* c-attribs.c (handle_optimize_attribute): Do not call
	cl_optimization_compare if we seen an error.
---
 gcc/c-family/c-attribs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index dbb892e0ec6..bdf72ce385c 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -5516,7 +5516,8 @@ handle_optimize_attribute (tree *node, tree name, tree args,
 
       if (saved_global_options != NULL)
 	{
-	  cl_optimization_compare (saved_global_options, &global_options);
+	  if (!seen_error ())
+	    cl_optimization_compare (saved_global_options, &global_options);
 	  free (saved_global_options);
 	}
     }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-12 11:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 14:37 [PATCH] opts: do not do sanity check when an error is seen Martin Liška
2021-12-16 16:44 ` Jeff Law
2022-01-12 11:52   ` Martin Liška

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).