Opened 3 years ago

Last modified 3 years ago

#64277 new defect

gcc49 error in pointer-set.c when building for ppc64: integer constant is too large for ‘unsigned long’ type

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: PowerPC, Leopard, ppc64, gcc Cc:
Port: gcc49

Description

Compilation breaks in stage 1 with:

opt/local/var/macports/build/_opt_PPCLeopardPorts_lang_gcc49/gcc49/work/gcc-4.9.4/gcc/pointer-set.c:45: error: integer constant is too large for ‘unsigned long’ type
/opt/local/var/macports/build/_opt_PPCLeopardPorts_lang_gcc49/gcc49/work/gcc-4.9.4/gcc/pointer-set.c: In function ‘size_t hash1(const void*, long unsigned int, long unsigned int)’:
/opt/local/var/macports/build/_opt_PPCLeopardPorts_lang_gcc49/gcc49/work/gcc-4.9.4/gcc/pointer-set.c:45: warning: large integer implicitly truncated to unsigned type
make[3]: *** [pointer-set.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_PPCLeopardPorts_lang_gcc49/gcc49/work/build/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCLeopardPorts_lang_gcc49/gcc49/work/build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_PPCLeopardPorts_lang_gcc49/gcc49/work/build'
make: *** [bootstrap-lean] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_PPCLeopardPorts_lang_gcc49/gcc49/work/build'
Command failed:  cd "/opt/local/var/macports/build/_opt_PPCLeopardPorts_lang_gcc49/gcc49/work/build" && /usr/bin/make -j4 -w bootstrap-lean 
Exit code: 2
Error: Failed to build gcc49: command execution failed

The source file has:

static inline size_t
hash1 (const void *p, unsigned long max, unsigned long logmax)
{
#if HOST_BITS_PER_LONG == 32
  const unsigned long A = 0x9e3779b9u;
#elif HOST_BITS_PER_LONG == 64
  const unsigned long A = 0x9e3779b97f4a7c16ul;
#else
  const unsigned long A
    = (ULONG_MAX + 1.0L) * 0.6180339887498948482045868343656381177203L;
#endif
  const unsigned long shift = HOST_BITS_PER_LONG - logmax;

  return ((A * (uintptr_t) p) >> shift) & (max - 1);
}

Specifically line 44-45 refer to 64 bit.

Change History (2)

comment:1 Changed 3 years ago by kencu (Ken)

the easiest thing to do here is to see if a newer gcc builds as you wish it to, like gcc 5, 6, or 7. If it does, but you still want gcc49, you can look at what was changed it that file in newer gcc versions, and try applying that fix to gcc49.

comment:2 in reply to:  1 Changed 3 years ago by barracuda156

Replying to kencu:

the easiest thing to do here is to see if a newer gcc builds as you wish it to, like gcc 5, 6, or 7. If it does, but you still want gcc49, you can look at what was changed it that file in newer gcc versions, and try applying that fix to gcc49.

Thank you, will try that. I have built gcc7 successfully on 10.5.8 as universal.

Note: See TracTickets for help on using tickets.