It's been quite a while since the last publicly available version of GCC under Solaris.
Particularly under Solaris 11.3 I've described how to install it long ago.
With the release of Solaris 11.4 Beta I decided to quickly review it.
# pkg info -r gcc
Name: developer/gcc
Summary: GCC
Category: Dev.../C (org.opensolaris.category.2008) Dev.../C++
(org.opensolaris.category.2008) Dev.../Fortran
(org.opensolaris.category.2008) De.../GNU
(org.opensolaris.category.2008) Dev.../Objective C
(org.opensolaris.category.2008)
State: Not installed
Publisher: solaris
Version: 5.5.0
Branch: 11.4.0.0.0.12.0
Packaging Date: Wed Jan 03 02:32:06 2018
Size: 2.52 kB
FMRI: pkg://.../developer/gcc@5.5.0-11.4.0.0.0.12.0:...
Project URL: http://gcc.gnu.org/
Source URL: http://ftp.gnu.org/.../gcc-5.5.0.tar.gz