lib/test: Cater for gcc-12.2.0.
These inexplicably avoid segfaults with gcc-12.2.0. * lib/tests/posix/50-open-read.c (main)[__GNUC__ > 11]: Use malloc instead of local allocated string. * lib/tests/scaffold/7i-struct-struct.c (main)[__GNUC__ > 11]: Initialize all fields of struct. * lib/tests/scaffold/t.c (main): Likewise.
This commit is contained in:
parent
ac1fab97e5
commit
074fa78f5e
|
@ -1,6 +1,6 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* GNU Mes --- Maxwell Equations of Software
|
* GNU Mes --- Maxwell Equations of Software
|
||||||
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
* Copyright © 2019, 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
*
|
*
|
||||||
* This file is part of GNU Mes.
|
* This file is part of GNU Mes.
|
||||||
*
|
*
|
||||||
|
@ -29,7 +29,12 @@ int
|
||||||
main (int argc, char const *argv[])
|
main (int argc, char const *argv[])
|
||||||
{
|
{
|
||||||
eputs ("test:getenv\n");
|
eputs ("test:getenv\n");
|
||||||
|
#if __GNUC__ > 11
|
||||||
|
char* file_name = malloc (PATH_MAX);
|
||||||
|
#else
|
||||||
|
// FIXME: gcc-12.2.0 fails open using this
|
||||||
char file_name[PATH_MAX];
|
char file_name[PATH_MAX];
|
||||||
|
#endif
|
||||||
char *srcdir = getenv ("abs_top_srcdir");
|
char *srcdir = getenv ("abs_top_srcdir");
|
||||||
if (! srcdir) // for running by hand
|
if (! srcdir) // for running by hand
|
||||||
srcdir = ".";
|
srcdir = ".";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* GNU Mes --- Maxwell Equations of Software
|
* GNU Mes --- Maxwell Equations of Software
|
||||||
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
* Copyright © 2017,2018,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
*
|
*
|
||||||
* This file is part of GNU Mes.
|
* This file is part of GNU Mes.
|
||||||
*
|
*
|
||||||
|
@ -48,7 +48,12 @@ struct anon
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
struct foo f = { 0, 1, 2 };
|
#if __GNUC__ > 11
|
||||||
|
struct foo f = { 0, 1, 2, 0, 0 };
|
||||||
|
#else
|
||||||
|
// FIXME: gcc-12.2.0 segfaults on this
|
||||||
|
struct foo f = { 0, 1, 2, 0 };
|
||||||
|
#endif
|
||||||
f.s.baz = 2;
|
f.s.baz = 2;
|
||||||
oputs ("f.s.bar=");
|
oputs ("f.s.bar=");
|
||||||
oputs (itoa (f.s.bar));
|
oputs (itoa (f.s.bar));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* GNU Mes --- Maxwell Equations of Software
|
* GNU Mes --- Maxwell Equations of Software
|
||||||
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
* Copyright © 2018,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
*
|
*
|
||||||
* This file is part of GNU Mes.
|
* This file is part of GNU Mes.
|
||||||
*
|
*
|
||||||
|
@ -214,7 +214,12 @@ main (int argc, char *argv[])
|
||||||
//i = (*fun2)(argc, argv);
|
//i = (*fun2)(argc, argv);
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
|
#if __GNUC__ > 11
|
||||||
|
int lst[6] = { -1, 1 - 1, i, 2, 3, 0 };
|
||||||
|
#else
|
||||||
|
// FIXME: gcc-12.2.0 segfaults on this
|
||||||
int lst[6] = { -1, 1 - 1, i, 2, 3 };
|
int lst[6] = { -1, 1 - 1, i, 2, 3 };
|
||||||
|
#endif
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
eputs ("i: ");
|
eputs ("i: ");
|
||||||
|
|
Loading…
Reference in a new issue