In order to compile gcc 4.9 on armv7 the patches below are required. I don't know if the approach for the configure patch is the correct way to inject -fbracket-depth=512 is the best way to do it. The patch for gcc/system.h had no effect on a i386 build. Perhaps this becomes handy if 6.3 packages are build for armv7.
Index: patches/patch-gcc_configure =================================================================== RCS file: /cvs/ports/lang/gcc/4.9/patches/patch-gcc_configure,v retrieving revision 1.5 diff -u -p -r1.5 patch-gcc_configure --- patches/patch-gcc_configure 1 Sep 2016 17:30:33 -0000 1.5 +++ patches/patch-gcc_configure 23 Mar 2018 17:39:58 -0000 @@ -1,7 +1,18 @@ $OpenBSD: patch-gcc_configure,v 1.5 2016/09/01 17:30:33 pascal Exp $ ---- gcc/configure.orig Sun May 22 10:53:32 2016 -+++ gcc/configure Sat Aug 6 19:19:05 2016 -@@ -17367,7 +17367,7 @@ openbsd*) +Index: gcc/configure +--- gcc/configure.orig ++++ gcc/configure +@@ -6597,6 +6597,9 @@ $as_echo "$ac_res" >&6; } + fi + done + CFLAGS="$save_CFLAGS" ++if [[ `uname -m` == armv7 ]] ; then ++ noexception_flags="$noexception_flags -fbracket-depth=512" ++fi + + + # Enable expensive internal checks +@@ -17367,7 +17370,7 @@ openbsd*) *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' @@ -10,7 +21,7 @@ $OpenBSD: patch-gcc_configure,v 1.5 2016 shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in -@@ -21027,7 +21027,7 @@ openbsd*) +@@ -21027,7 +21030,7 @@ openbsd*) *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' @@ -19,7 +30,7 @@ $OpenBSD: patch-gcc_configure,v 1.5 2016 shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in -@@ -27522,6 +27522,7 @@ else +@@ -27522,6 +27525,7 @@ else fi ;; Index: patches/patch-gcc_system_h =================================================================== RCS file: patches/patch-gcc_system_h diff -N patches/patch-gcc_system_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-gcc_system_h 23 Mar 2018 17:39:58 -0000 @@ -0,0 +1,13 @@ +$OpenBSD$ + +Index: gcc/system.h +--- gcc/system.h.orig ++++ gcc/system.h +@@ -231,6 +231,7 @@ extern int errno; + file uses a standard library header that includes <cstdlib>, we will get + an error about 'using std::malloc'. */ + #ifdef __cplusplus ++#include <new> + #include <cstdlib> + #endif +