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 <[email protected]>
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;
}