Module Name:    src
Committed By:   kre
Date:           Fri Oct 20 22:08:52 UTC 2023

Modified Files:
        src/bin/sh: parser.c

Log Message:
Work around a probably gcc12 bug in detecting "potentially clobbered"
variables after longjmp() for some architectures (sh3 at least).

This should allow the workaround to disable those warnings for this
file to be removed.

In the affected function the extra var & assignment added should simply
be deleted by any good optimiser, but if not, it doesn't matter, as
performance of this function (expandonstack()) is almost irrelevant.


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/bin/sh/parser.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.180 src/bin/sh/parser.c:1.181
--- src/bin/sh/parser.c:1.180	Fri Apr  7 10:34:13 2023
+++ src/bin/sh/parser.c	Fri Oct 20 22:08:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.180 2023/04/07 10:34:13 kre Exp $	*/
+/*	$NetBSD: parser.c,v 1.181 2023/10/20 22:08:52 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.180 2023/04/07 10:34:13 kre Exp $");
+__RCSID("$NetBSD: parser.c,v 1.181 2023/10/20 22:08:52 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -2689,6 +2689,7 @@ expandonstack(char *ps, int cmdsub, int 
 	struct jmploc jmploc;
 	struct jmploc *const savehandler = handler;
 	struct parsefile *const savetopfile = getcurrentfile();
+	char * const save_ps = ps;
 	const int save_x = xflag;
 	const int save_e_s = errors_suppressed;
 	struct parse_state new_state = init_parse_state;
@@ -2740,7 +2741,7 @@ expandonstack(char *ps, int cmdsub, int 
 	errors_suppressed = save_e_s;
 
 	if (result == NULL)
-		result = ps;
+		result = save_ps;
 
 	return result;
 }

Reply via email to