Bug 241125 - lang/gcc9: Fails to build on 32-bit 12.1-BETA2/powerpc: error: integer constant is too large for 'long' type
Summary: lang/gcc9: Fails to build on 32-bit 12.1-BETA2/powerpc: error: integer consta...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: powerpc Any
: --- Affects Some People
Assignee: Gerald Pfeifer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-08 06:15 UTC by Ari Suutari
Modified: 2020-03-26 14:17 UTC (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ari Suutari 2019-10-08 06:15:48 UTC
gcc 9.2.0 port doesn't compile on powerpc platform:

c++ -std=gnu++98 -fno-PIE -c   -g -DIN_GCC    -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/. -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/../include -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/../libcpp/include -I/usr/local/include  -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/../libdecnumber -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/../libdecnumber/dpd -I../libdecnumber -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/../libbacktrace  -DLIBICONV_PLUG -o insn-emit.o -MT insn-emit.o -MMD -MP -MF ./.deps/insn-emit.TPo insn-emit.c
/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/config/rs6000/rs6000.md:5933: error: integer constant is too large for 'long' type

Tried on 12.1-BETA2:
FreeBSD applejuice 12.1-BETA2 FreeBSD 12.1-BETA2 GENERIC  powerpc
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2019-10-08 06:21:41 UTC
Is this on literal "powerpc" (32-bit) or "powerpc64" (64-bit), or one of the other variants instead?
Comment 2 Ari Suutari 2019-10-08 06:48:15 UTC
This is old Mac Mini so 32-bit:

kernel: cpu0: Motorola PowerPC 7447A revision 1.2, 1249.10 MHz
kernel: cpu0: Features 9c000000<PPC32,ALTIVEC,FPU,MMU>
kernel: cpu0: HID0 8450c0bc<EMCP,TBEN,NAP,DPM,ICE,DCE,SGE,BTIC,LRSTK,FOLD,BHT>
Comment 3 canardo 2019-10-10 12:51:01 UTC
Same error also present in FreeBSD 12.0-RELEASE

I don't know if the bug title should be updated/edited accordingly, or if a new ticket should be created.

On my machine, Powerbook G4 17, same error when compiling gcc-9.2.0

gmake[5]: Entering directory '/usr/ports/lang/gcc9/work/.build/gcc'
c++ -std=gnu++98 -fno-PIE -c   -g -DIN_GCC    -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/. -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/../include -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/../libcpp/include -I/usr/local/include  -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/../libdecnumber -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/../libdecnumber/dpd -I../libdecnumber -I/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/../libbacktrace  -DLIBICONV_PLUG -o insn-emit.o -MT insn-emit.o -MMD -MP -MF ./.deps/insn-emit.TPo insn-emit.c
/usr/ports/lang/gcc9/work/gcc-9.2.0/gcc/config/rs6000/rs6000.md:5933: error: integer constant is too large for 'long' type
gmake[5]: *** [Makefile:1116: insn-emit.o] Error 1



uname -mrs
FreeBSD 12.0-RELEASE powerpc

getconf LONG_BIT
32

sysctl -a hw.model
hw.model: Motorola PowerPC 7447A
Comment 4 jlibster 2019-10-17 04:06:21 UTC
Identical bug in FreeBSD 11.3 PowerPC architecture on ports build
Comment 5 Antonio Pisano 2019-10-17 22:44:46 UTC
Confirm this bug on my PowerBook G4

My uname -a: FreeBSD newton 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC  powerpc
Comment 6 Antonio Pisano 2019-10-17 23:03:14 UTC
Forum thread at https://forums.freebsd.org/threads/i-could-use-some-help-compiling-xorg-for-my-ibook-g4.72492/ might provide additional insight.
Comment 7 Segher Boessenkool 2019-11-10 22:25:19 UTC
Hi!  What is your host compiler, and its version?
Comment 8 canardo 2019-11-11 09:54:52 UTC
My version of FreeBSD is FreeBSD 12.0-RELEASE powerpc freshly installed, with no changes to default values. So I guess the compiler is the default one (clang ??).

If you post command lines, I can run them on my machine and post results here.
Comment 9 Mikael Urankar freebsd_committer 2019-11-11 12:10:36 UTC
(In reply to canardo from comment #8)
it's gcc 4.2.1 on 12.0
Comment 10 Piotr Kubaj freebsd_committer 2019-11-17 17:19:59 UTC
Can you try the same workaround that's been put in for powerpc64, i.e. using gcc8?
Comment 11 Gerald Pfeifer freebsd_committer 2019-11-17 20:32:22 UTC
For those experiencing this issue, can you please post the output of

  cc --version


Segher, 

https://forums.freebsd.org/threads/i-could-use-some-help-compiling-xorg-for-my-ibook-g4.72492/
identifies 
https://github.com/gcc-mirror/gcc/commit/4b4c309c5ddb4cf08c87fc552d8c85e89de32e14
by Carl Love as the GCC commit this caused this.
Comment 12 segher 2019-11-17 21:06:57 UTC
Yes, and I identify https://gcc.gnu.org/r278107 as the commit that fixes it :-)

I'll backport that (to GCC 9) later this week.

(Please report GCC bugs in GCC bugzilla.  Thanks!)
Comment 13 canardo 2019-11-18 11:07:01 UTC
On my machine:

cc --version
cc (GCC) 4.2.1 20070831 patched [FreeBSD]
Comment 14 segher 2019-11-18 19:56:18 UTC
I have done the backport.  When FreeBSD gets a new snapshot from the
gcc-9-branch it will have the fix.
Comment 15 Gerald Pfeifer freebsd_committer 2019-11-20 19:27:37 UTC
Lovely, thank you Segher!

The next snapshot update I'll be committing (to lang/gcc9-devel) is *not*
going to have this yet, but the one I'll commit in about a week (which is
going to be this coming Saturday's) should.

And then I'll be looking into adding a temporary patch for lang/gcc9 since
the next minor release from the GCC 9 branch probably is a little too far
out.
Comment 16 commit-hook freebsd_committer 2019-11-27 10:42:44 UTC
A commit references this bug:

Author: gerald
Date: Wed Nov 27 10:41:54 UTC 2019
New revision: 518494
URL: https://svnweb.freebsd.org/changeset/ports/518494

Log:
  Update to the 20191123 snapshot of GCC 9.2.1.

  This addresses a build failure on powerpc ("error: integer constant is
  too large for 'long' type"). [1]

  It also brings three improvements for both the tree optimizers and middle
  end, plus one each for i386 and powerpc, and several on the C++ side.

  PR:		241125 [1]

Changes:
  head/lang/gcc9-devel/Makefile
  head/lang/gcc9-devel/distinfo
Comment 17 commit-hook freebsd_committer 2019-11-29 13:48:17 UTC
A commit references this bug:

Author: gerald
Date: Fri Nov 29 13:47:58 UTC 2019
New revision: 518650
URL: https://svnweb.freebsd.org/changeset/ports/518650

Log:
  Temporarily apply a patch from upstream that addresses a build failure
  on powerpc ("error: integer constant is too large for 'long' type").

  This is already part of lang/gcc9-devel after r518494 and the 20191123
  snapshot of GCC 9.2.1; it will be part of the GCC 9.3 release at which
  point we can remove this local patch again.

  PR:		241125

Changes:
  head/lang/gcc9/files/patch-powerpc32
Comment 18 Gerald Pfeifer freebsd_committer 2019-11-29 13:53:14 UTC
Sodala, I think we are done and have addressed this everywhere possible.

Thanks to everyone who helped nail this down!
Comment 19 commit-hook freebsd_committer 2020-03-26 14:17:46 UTC
A commit references this bug:

Author: gerald
Date: Thu Mar 26 14:16:58 UTC 2020
New revision: 529189
URL: https://svnweb.freebsd.org/changeset/ports/529189

Log:
  Update to the GCC 9.3 release, which fixes some 157 further bugs.

  This remains the default version of GCC in the Ports Collection, and
  this update mostly addresses regressions.

  files/patch-powerpc32 was a backport from this release branch to begin
  with and has now become obsolete. [1]

  PR:		241125 [1]

Changes:
  head/lang/gcc9/Makefile
  head/lang/gcc9/distinfo
  head/lang/gcc9/files/patch-powerpc32