public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] fix AIX fortran builds
@ 2017-10-30  6:36 Jim Wilson
  2017-10-30 17:04 ` Thomas Koenig
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Wilson @ 2017-10-30  6:36 UTC (permalink / raw)
  To: gcc-patches, fortran

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

A Power AIX build with fortran enabled fails in stage2, because longjmp
is not declared noreturn in system header files.  That is probably only
true on systems where gcc is the system compiler, since this is a GCC
extension.

.../../gcc-git/gcc/fortran/parse.c: In function 'void unexpected_eof()':
.../../gcc-git/gcc/fortran/parse.c:2740:1: error: 'noreturn' function
does return [-Werror]
 }
  ^

If I drop ATTRIBUTE_NORETURN on the unexpected_eof declaration, then I
get 18 errors that look like this one.  This is stage2 of a linux
build.

.../../gcc-svn/gcc/fortran/parse.c: In function ‘gfc_statement
parse_spec(gfc_statement)’:
.../../gcc-svn/gcc/fortran/parse.c:3745:22: error: this statement may
fall through [-Werror=implicit-fallthrough=]
       unexpected_eof ();
       ~~~~~~~~~~~~~~~^~
.../../gcc-svn/gcc/fortran/parse.c:3747:5: note: here
     case ST_IMPLICIT_NONE:
     ^~~~

If I add a call to gcc_unreachable after the longjmp call, then it
builds on both linux and AIX.  Anyone have a better idea on how to fix
this?  If I don't get any responses in a few days, I will check it in
under the obvious rule, since it fixes a build failure.

Jim


[-- Attachment #2: Type: text/x-patch, Size: 505 bytes --]

2017-10-29  Jim Wilson  <wilson@tuliptree.org>

	gcc/fortran/
	* parse.c (unexpected_eof): Call gcc_unreachable before return.

Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c	(revision 254210)
+++ gcc/fortran/parse.c	(working copy)
@@ -2737,6 +2737,9 @@ unexpected_eof (void)
   gfc_done_2 ();
 
   longjmp (eof_buf, 1);
+
+  /* Avoids build error on systems where longjmp is not declared noreturn.  */
+  gcc_unreachable ();
 }
 
 

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

* Re: [PATCH] fix AIX fortran builds
  2017-10-30  6:36 [PATCH] fix AIX fortran builds Jim Wilson
@ 2017-10-30 17:04 ` Thomas Koenig
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Koenig @ 2017-10-30 17:04 UTC (permalink / raw)
  To: Jim Wilson, gcc-patches, fortran

Hi Jim,

> If I add a call to gcc_unreachable after the longjmp call, then it
> builds on both linux and AIX.  Anyone have a better idea on how to fix
> this?  If I don't get any responses in a few days, I will check it in
> under the obvious rule, since it fixes a build failure.

The patch is OK.

Thanks!

Regards

	Thomas

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

end of thread, other threads:[~2017-10-30 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-30  6:36 [PATCH] fix AIX fortran builds Jim Wilson
2017-10-30 17:04 ` Thomas Koenig

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