bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* mcel tests: Fix test failure with Oracle cc 12.6
@ 2024-03-29  1:20 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2024-03-29  1:20 UTC (permalink / raw
  To: bug-gnulib

With cc from Oracle Developer Studio 12.6 on Linux, I see a test failure:

FAIL: test-mcel
===============

FAIL test-mcel (exit status: 1)

This compiler does not implement the rule (from ISO C 99 § 5.1.2.2.3) that
the implicit return value from main() is 0. How to reproduce:

=================== foo.c ==================
int main (int argc, char *argv[])
{
  if (argc == 7) return 2;
}
============================================

$ cc -O -m64 foo.c
$ ./a.out ; echo $?
2
$ cc -O -m64 -std=gnu99 -xlang=c99 foo.c
$ ./a.out ; echo $?
2
$ cc -O -m64 -xc99 foo.c
$ ./a.out ; echo $?
2

This patch provides a workaround.


2024-03-28  Bruno Haible  <bruno@clisp.org>

	mcel tests: Fix test failure with Oracle cc 12.6.
	* tests/test-mcel.c (main): Explicitly return 0 at the end.

diff --git a/tests/test-mcel.c b/tests/test-mcel.c
index 7bff8b1387..6988fffeee 100644
--- a/tests/test-mcel.c
+++ b/tests/test-mcel.c
@@ -135,4 +135,6 @@ main (void)
                 }
             }
         }
+
+  return 0;
 }





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-29  1:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-29  1:20 mcel tests: Fix test failure with Oracle cc 12.6 Bruno Haible

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