Bug 80626 - [7/8 Regression] Ada x32 multilib build failure for a-cfinve.ads
Summary: [7/8 Regression] Ada x32 multilib build failure for a-cfinve.ads
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 7.1.0
: P3 normal
Target Milestone: 7.2
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-04 12:15 UTC by Steven Noonan
Modified: 2017-05-10 17:37 UTC (History)
1 user (show)

See Also:
Host:
Target: x86_64-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-05-10 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Noonan 2017-05-04 12:15:13 UTC
I'm sure this would be trivial to fix if I knew any Ada at all, but I've run into this build failure for GCC 7.1.0 when built with --with-multilib=m32,m64,mx32 for x86_64.

make[9]: Entering directory '/home/steven/gcc-multilib/src/gcc-build/gcc/ada/rts_x32'
[...]
/home/steven/gcc-multilib/src/gcc-build/./gcc/xgcc -B/home/steven/gcc-multilib/src/gcc-build/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include    -c -g -O2 -mx32 -fpic  -W -Wall -gnatpg -nostdinc -mx32  a-cfinve.adb -o a-cfinve.o
a-cfinve.ads:245:04: warning: in instantiation at a-coboho.adb:55
a-cfinve.ads:245:04: warning: types for unchecked conversion have different sizes
make[9]: *** [../gcc-interface/Makefile:296: a-cfinve.o] Error 1

Any ideas?
Comment 1 Steven Noonan 2017-05-04 12:16:47 UTC
I configured with these flags, if they're needed for repro:

--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://www.uplinklabs.net/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --disable-libssp --disable-libstdcxx-pch --disable-libunwind-exceptions --disable-werror --enable-checking=release --enable-clocale=gnu --enable-__cxa_atexit --enable-gnu-indirect-function --enable-gnu-unique-object --enable-install-libiberty --enable-libmpx --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --with-isl --with-linker-hash-style=gnu --with-multilib-list=m32,m64,mx32 --with-system-zlib
Comment 2 Steven Noonan 2017-05-04 12:56:32 UTC
It looks like this is just the first of several files with that build issue. If I build with 'make -k' I see several others fail with the same warning, e.g.:

/home/steven/gcc-multilib/src/gcc-build/./gcc/xgcc -B/home/steven/gcc-multilib/src/gcc-build/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include    -c -g -O2 -mx32 -fpic  -W -Wall -gnatpg -nostdinc -mx32  g-allein.ads -o g-allein.o
g-allein.ads:183:04: warning: types for unchecked conversion have different sizes
g-allein.ads:185:04: warning: types for unchecked conversion have different sizes
g-allein.ads:187:04: warning: types for unchecked conversion have different sizes
g-allein.ads:189:04: warning: types for unchecked conversion have different sizes
g-allein.ads:191:04: warning: types for unchecked conversion have different sizes
[... many more in the same file ...]

/home/steven/gcc-multilib/src/gcc-build/./gcc/xgcc -B/home/steven/gcc-multilib/src/gcc-build/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include    -c -g -O2 -mx32 -fpic  -W -Wall -gnatpg -nostdinc -mx32  s-wwdenu.adb -o s-wwdenu.o
s-wwdenu.adb:55:07: warning: types for unchecked conversion have different sizes
s-wwdenu.adb:94:07: warning: types for unchecked conversion have different sizes
s-wwdenu.adb:133:07: warning: types for unchecked conversion have different sizes
s-wwdenu.adb:172:07: warning: types for unchecked conversion have different sizes
s-wwdenu.adb:211:07: warning: types for unchecked conversion have different sizes
s-wwdenu.adb:250:07: warning: types for unchecked conversion have different sizes


And several files fail with a different warning:

/home/steven/gcc-multilib/src/gcc-build/./gcc/xgcc -B/home/steven/gcc-multilib/src/gcc-build/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include    -c -g -O2 -mx32 -fpic  -W -Wall -gnatpg -nostdinc -mx32  a-dispat.adb -o a-dispat.o
s-osinte.ads:608:07: size for "Address" too small, minimum allowed is 64
make[9]: *** [../gcc-interface/Makefile:296: a-dispat.o] Error 1
/home/steven/gcc-multilib/src/gcc-build/./gcc/xgcc -B/home/steven/gcc-multilib/src/gcc-build/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include    -c -g -O2 -mx32 -fpic  -W -Wall -gnatpg -nostdinc -mx32  a-dynpri.adb -o a-dynpri.o
s-osinte.ads:608:07: size for "Address" too small, minimum allowed is 64
make[9]: *** [../gcc-interface/Makefile:296: a-dynpri.o] Error 1
/home/steven/gcc-multilib/src/gcc-build/./gcc/xgcc -B/home/steven/gcc-multilib/src/gcc-build/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include    -c -g -O2 -mx32 -fpic  -W -Wall -gnatpg -nostdinc -mx32  a-interr.adb -o a-interr.o
s-osinte.ads:608:07: size for "Address" too small, minimum allowed is 64
make[9]: *** [../gcc-interface/Makefile:296: a-interr.o] Error 1
Comment 3 H.J. Lu 2017-05-10 02:29:51 UTC
We need something similar to

commit 5821cbd2fa002acf67add968862c6d4fe847fa89
Author: krebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Apr 4 11:45:37 2017 +0000

    [Ada][S/390] Fix Memory_Size definition.
    
    -m31 -mzarch uses 64 as word size instead of 32.  This must not affect
    the Address type definition which is based on Memory_Size.
    
    gcc/ada/ChangeLog:
    
    2017-04-04  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
    
            * system-linux-s390.ads: Use Long_Integer'Size to define
            Memory_Size.
    
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246678 138bc75d-0d04-0410-961f-82ee72b054a4

Please try

diff --git a/gcc/ada/system-linux-x86.ads b/gcc/ada/system-linux-x86.ads
index 22a212e..533d94e 100644
--- a/gcc/ada/system-linux-x86.ads
+++ b/gcc/ada/system-linux-x86.ads
@@ -70,7 +70,7 @@ package System is
 
    Storage_Unit : constant := 8;
    Word_Size    : constant := Standard'Word_Size;
-   Memory_Size  : constant := 2 ** Word_Size;
+   Memory_Size  : constant := 2 ** Long_Integer'Size;
 
    --  Address comparison
Comment 4 Andreas Schwab 2017-05-10 07:35:10 UTC
See also PR80117.
Comment 5 Steven Noonan 2017-05-10 10:26:21 UTC
(In reply to H.J. Lu from comment #3)
> Please try
> 
> diff --git a/gcc/ada/system-linux-x86.ads b/gcc/ada/system-linux-x86.ads
> index 22a212e..533d94e 100644
> --- a/gcc/ada/system-linux-x86.ads
> +++ b/gcc/ada/system-linux-x86.ads
> @@ -70,7 +70,7 @@ package System is
>  
>     Storage_Unit : constant := 8;
>     Word_Size    : constant := Standard'Word_Size;
> -   Memory_Size  : constant := 2 ** Word_Size;
> +   Memory_Size  : constant := 2 ** Long_Integer'Size;
>  
>     --  Address comparison

This seems to build perfectly for --with-multilib=m32,m64,mx32.
Comment 6 hjl@gcc.gnu.org 2017-05-10 17:35:34 UTC
Author: hjl
Date: Wed May 10 17:35:02 2017
New Revision: 247849

URL: https://gcc.gnu.org/viewcvs?rev=247849&root=gcc&view=rev
Log:
Ada/x32: PR ada/80626: Correct Memory_Size

X32 uses 64 as word size instead of 32.  This must not affect the
Address type definition which is based on Memory_Size.

	PR ada/80626
	* system-linux-x86.ads (Memory_Size): Use Long_Integer'Size
	instead of Word_Size.

Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/system-linux-x86.ads
Comment 7 hjl@gcc.gnu.org 2017-05-10 17:37:22 UTC
Author: hjl
Date: Wed May 10 17:36:50 2017
New Revision: 247850

URL: https://gcc.gnu.org/viewcvs?rev=247850&root=gcc&view=rev
Log:
Ada/x32: PR ada/80626: Correct Memory_Size

X32 uses 64 as word size instead of 32.  This must not affect the
Address type definition which is based on Memory_Size.

	Back port from mainline
	PR ada/80626
	* system-linux-x86.ads (Memory_Size): Use Long_Integer'Size
	instead of Word_Size.

Modified:
    branches/gcc-7-branch/gcc/ada/ChangeLog
    branches/gcc-7-branch/gcc/ada/system-linux-x86.ads
Comment 8 H.J. Lu 2017-05-10 17:37:41 UTC
Fixed on trunk and for 7.2.