Bug#742590: gnat-4.9: FTBFS on powerpc, Storage_Error in two source files

2014-03-29 Thread Nicolas Boulenguez
Package: src:gnat-4.9
Followup-For: Bug #742590

At least three failures affect build/gcc/ada/rts-static-zcx.
A 54 compiler segfault when optimization is asked.
B 106 warnings (= errors with -gnatg), mostly about conversions
  between types with different sizes.
C 46 errors caused by the same problem:
  s-osinte.ads:590:07: size for Address too small, minimum allowed is 64

Investigating the latter, I have found a bug in build/gcc/xgcc.
Standard'Address_Size should match System.Address'Size but does not:
# debian/rules binary-arch
... fails
# cd build/gcc/ada/rts-static-zcx
# cat  hello.ads EOF
with System;
package Hello is
   Standard_Address_Size : constant Integer := Standard'Address_Size;
   System_Address_Size   : constant Integer := System.Address'Size;
end Hello;
EOF
# ../../xgcc -B../.. -c -gnatpg -nostdinc hello.ads -gnatG | grep address_size
  hello__standard_address_size : constant integer := 32;
  hello__system_address_size : constant integer := 64;

In case this helps others, I attach a diff listing which file is
affected by each problem, and preventing the effects to abort the
compilation.
--- old.in.mk	2014-03-29 11:18:53.576474900 +0100
+++ new.in.mk	2014-03-29 15:57:34.287388432 +0100
@@ -2738,23 +2738,20 @@
 # optimization.
 
 s-traceb.o  : s-traceb.adb s-traceb.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) \
-	  $(NO_SIBLING_ADAFLAGS) $(ADA_INCLUDES) $ $(OUTPUT_OPTION)
+s-traceb.o  : ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS) $(NO_SIBLING_ADAFLAGS)
 
 # force debugging information on s-tasdeb.o so that it is always
 # possible to set conditional breakpoints on tasks.
 
 s-tasdeb.o  : s-tasdeb.adb s-tasdeb.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
-	  $ $(OUTPUT_OPTION)
+s-tasdeb.o  : ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS) -O0
 
 # force debugging information on s-vaflop.o so that it is always
 # possible to call the VAX float debug print routines.
 # force at least -O so that the inline assembly works.
 
 s-vaflop.o  : s-vaflop.adb s-vaflop.ads
-	$(CC) -c -O $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
-	  $ $(OUTPUT_OPTION)
+s-vaflop.o  : ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS)
 
 # force no function reordering on a-except.o because of the exclusion bounds
 # mechanism (see the source file for more detailed information).
@@ -2763,30 +2760,27 @@
 # use -O1 otherwise gdb isn't able to get a full backtrace on mips targets.
 
 a-except.o  : a-except.adb a-except.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O1 -fno-inline \
-	  $(NO_REORDER_ADAFLAGS) $(ADA_INCLUDES) $ $(OUTPUT_OPTION)
+a-except.o  : ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS) -O1 -fno-inline \
+  $(NO_REORDER_ADAFLAGS)
 
 # compile s-excdeb.o without optimization and with debug info to let the
 # debugger set breakpoints and inspect subprogram parameters on exception
 # related events.
 
 s-excdeb.o  : s-excdeb.adb s-excdeb.ads s-except.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
-	  $ $(OUTPUT_OPTION)
+s-excdeb.o  : ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS) -O0
 
 # force debugging information on s-assert.o so that it is always
 # possible to set breakpoint on assert failures.
 
 s-assert.o  : s-assert.adb s-assert.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
-	  $ $(OUTPUT_OPTION)
+s-assert.o  : ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS)
 
 # force debugging information on a-tags.o so that the debugger can find
 # the description of Ada.Tags.Type_Specific_Data.
 
 a-tags.o  : a-tags.adb a-tags.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
-	  $ $(OUTPUT_OPTION)
+a-tags.o  : ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS)
 
 # need to keep the frame pointer in this file to pop the stack properly on
 # some targets.
@@ -2794,6 +2788,56 @@
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
 	  $(INCLUDES) -fno-omit-frame-pointer $ $(OUTPUT_OPTION)
 
+# If kept, all this should be restricted to powerpc or powerpc%.
+# Avoid any optimization otherwise gnat1 crashes on powerpc.
+
+a-direct.o a-except.o a-finali.o a-stream.o a-strunb.o a-ststio.o \
+a-stwima.o a-stwiun.o a-stzmap.o a-stzunb.o a-synbar.o a-sytaco.o \
+a-tasatt.o a-taside.o a-taster.o a-textio.o a-witeio.o a-ztexio.o \
+g-awk.og-catiio.o g-cgideb.o g-debpoo.o g-expect.o g-exptty.o \
+g-pehage.o g-semaph.o g-sercom.o g-signal.o g-socket.o g-spipat.o \
+g-sptabo.o g-sptain.o g-sptavs.o g-strspl.o g-thread.o g-wistsp.o \
+g-zstspl.o s-asthan.o s-chepoo.o s-direio.o s-ficobl.o s-fileio.o \
+s-finmas.o s-finroo.o s-parint.o s-pooglo.o s-pooloc.o s-poosiz.o \
+s-regexp.o s-rpc.os-sequio.o s-shasto.o s-stopoo.o s-stposu.o \
+  : ALL_ADAFLAGS += -O0
+
+# Warnings are treated as errors because of -gnatg.
+# Disable this behaviour on some files to inspect powerpc problems.
+
+a-interr.o a-intnam.o a-intsig.o a-reatim.o a-retide.o a-rttiev.o \
+a-tags.o   

Bug#742590: gnat-4.9: FTBFS on powerpc, Storage_Error in two source files

2014-03-29 Thread Nicolas Boulenguez
Package: src:gnat-4.9
Followup-For: Bug #742590
Control: retitle -1 FTBFS on powerpc, wrong System.Address'Size
Control: tags -1 + pending

Revision b1ec15211bb78fd840cc96b500d13e5f1531f9b8 fixes this issue.

In order to help next newcomer to modify flags for specific sources,
please consider applying or forwarding the attached diff.
Two points deserve review:
* debian/ada-symbolic-tracebacks.diff adds this line:
  +convert_addresses.o : convert_addresses.c
  I believe this is redundant and can safely be removed.
* the recipe for tracebak.o inserts -fno-omit-frame-pointer after
  INCLUDES, and my diff inserts it after ALL_COMPILERFLAGS.
  I believe that flags ordering does not matter here.
--- a/src/gcc/ada/gcc-interface/Makefile.in	2014-03-29 22:52:13.090202118 +0100
+++ b/src/gcc/ada/gcc-interface/Makefile.in	2014-03-30 00:14:48.402774180 +0100
@@ -290,21 +290,26 @@
 # Avoid a lot of time thinking about remaking Makefile.in and *.def.
 .SUFFIXES: .in .def
 
-# Say how to compile Ada programs.
-.SUFFIXES: .ada .adb .ads .asm
-
+# Generic compilation recipes.
+# Flags or prerequisites for specific sources are added later.
 # Always use -I$(srcdir)/config when compiling.
-.asm.o:
+
+# How to build assembly sources.
+%.o: %.asm
 	$(CC) -c -x assembler $ $(OUTPUT_OPTION)
 
-.c.o:
+# How to build C sources. The header, if any, is a prerequisite.
+%.o: %.c %.h
+	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
+	  $(INCLUDES) $ $(OUTPUT_OPTION)
+%.o: %.c
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
 	  $(INCLUDES) $ $(OUTPUT_OPTION)
 
-.adb.o:
+# How to build Ada sources. The body, if any, is a prerequisite.
+%.o: %.adb %.ads
 	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $ $(OUTPUT_OPTION)
-
-.ads.o:
+%.o: %.ads
 	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $ $(OUTPUT_OPTION)
 
 # how to regenerate this file
@@ -2736,111 +2741,55 @@
 # force no sibling call optimization on s-traceb.o so the number of stack
 # frames to be skipped when computing a call chain is not modified by
 # optimization.
-
-s-traceb.o  : s-traceb.adb s-traceb.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) \
-	  $(NO_SIBLING_ADAFLAGS) $(ADA_INCLUDES) $ $(OUTPUT_OPTION)
+s-straceb.o: ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS) $(NO_SIBLING_ADAFLAGS)
 
 # force debugging information on s-tasdeb.o so that it is always
 # possible to set conditional breakpoints on tasks.
-
-s-tasdeb.o  : s-tasdeb.adb s-tasdeb.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
-	  $ $(OUTPUT_OPTION)
+s-tasdeb.o: ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS) -O0
 
 # force debugging information on s-vaflop.o so that it is always
 # possible to call the VAX float debug print routines.
 # force at least -O so that the inline assembly works.
-
-s-vaflop.o  : s-vaflop.adb s-vaflop.ads
-	$(CC) -c -O $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
-	  $ $(OUTPUT_OPTION)
+s-vaflop.o: ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS)
 
 # force no function reordering on a-except.o because of the exclusion bounds
 # mechanism (see the source file for more detailed information).
 # force debugging information on a-except.o so that it is always
 # possible to set conditional breakpoints on exceptions.
 # use -O1 otherwise gdb isn't able to get a full backtrace on mips targets.
-
-a-except.o  : a-except.adb a-except.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O1 -fno-inline \
-	  $(NO_REORDER_ADAFLAGS) $(ADA_INCLUDES) $ $(OUTPUT_OPTION)
+a-except.o: ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS) -O1 -fno-inline \
+$(NO_REORDER_ADAFLAGS)
 
 # compile s-excdeb.o without optimization and with debug info to let the
 # debugger set breakpoints and inspect subprogram parameters on exception
 # related events.
-
-s-excdeb.o  : s-excdeb.adb s-excdeb.ads s-except.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
-	  $ $(OUTPUT_OPTION)
+s-excdeb.o: s-except.ads
+s-excdeb.o: ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS) -O0
 
 # force debugging information on s-assert.o so that it is always
 # possible to set breakpoint on assert failures.
-
-s-assert.o  : s-assert.adb s-assert.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
-	  $ $(OUTPUT_OPTION)
+s-assert.o: ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS)
 
 # force debugging information on a-tags.o so that the debugger can find
 # the description of Ada.Tags.Type_Specific_Data.
-
-a-tags.o  : a-tags.adb a-tags.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
-	  $ $(OUTPUT_OPTION)
+a-tags.o: ALL_ADAFLAGS += $(FORCE_DEBUG_ADAFLAGS)
 
 # need to keep the frame pointer in this file to pop the stack properly on
 # some targets.
-tracebak.o  : tracebak.c tb-alvms.c tb-alvxw.c tb-gcc.c
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
-	  $(INCLUDES) -fno-omit-frame-pointer $ $(OUTPUT_OPTION)
+tracebak.o: tb-alvms.c tb-alvxw.c 

Bug#742590: gnat-4.9: FTBFS on powerpc, Storage_Error in two source files

2014-03-27 Thread Nicolas Boulenguez
Package: src:gnat-4.9
Followup-For: Bug #742590

When compiling a-direct.adb on partch.debian.org, the failure appears
with -O[12] but not with -O0.  Gdb shows that it happens in the gnat1
subprocess and produces a backtrace.

$ gdb ../../xgcc
(gdb) set args  -B../.. -c -O1 -gnatpg  a-direct.adb -o a-direct.o
(gdb) set follow-fork-mode child
(gdb) run
[ New process ]
Program received signal SIGSEGV, Segmentation fault.
0x1065cb10 in emit_move_insn(rtx_def*, rtx_def*) ()
(gdb) bt
#0  0x1065cb10 in emit_move_insn(rtx_def*, rtx_def*) ()
#1  0x1065de2c in convert_move(rtx_def*, rtx_def*, int) ()
#2  0x1065e2a0 in convert_modes(machine_mode, machine_mode, rtx_def*,
int) ()
#3  0x10667f00 in expand_expr_real_2(separate_ops*, rtx_def*,
machine_mode, expand_modifier) ()
#4  0x10659114 in expand_expr_real_1(tree_node*, rtx_def*,
machine_mode, expand_modifier, rtx_def**, bool) ()
#5  0x1065a590 in expand_expr_real_1(tree_node*, rtx_def*,
machine_mode, expand_modifier, rtx_def**, bool) ()
#6  0x10664448 in store_expr(tree_node*, rtx_def*, int, bool) ()
#7  0x106690e4 in expand_assignment(tree_node*, tree_node*, bool) ()
#8  0x10579f58 in expand_gimple_stmt(gimple_statement_base*) ()
#9  0x1057b57c in expand_gimple_basic_block(basic_block_def*, bool) ()
#10 0x1057d74c in (anonymous namespace)::pass_expand::execute() ()
#11 0x107e7bc4 in execute_one_pass(opt_pass*) ()
#12 0x107e7e44 in execute_pass_list(opt_pass*) ()
#13 0x105a4e08 in expand_function(cgraph_node*) ()
#14 0x105a6c44 in compile() ()
#15 0x105a7244 in finalize_compilation_unit() ()
#16 0x101e11a4 in gnat_write_global_declarations() ()
#17 0x108a0254 in compile_file() ()
#18 0x108a25d8 in toplev_main(int, char**) ()
#19 0x0fa4f274 in generic_start_main (main=0x101b6550 main, argc=14,
argv=0xe5f4, auxvec=0xe690, init=optimized out,
rtld_fini=optimized out, stack_end=optimized out,
fini=optimized out) at ../csu/libc-start.c:287
#20 0x0fa4f434 in __libc_start_main (argc=optimized out,
argv=optimized out, ev=optimized out, auxvec=optimized out,
rtld_fini=optimized out, stinfo=optimized out,
stack_on_entry=optimized out)
at ../sysdeps/unix/sysv/linux/powerpc/libc-start.c:93
#21 0x in ?? ()


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#742590: gnat-4.9: FTBFS on powerpc, Storage_Error in two source files

2014-03-25 Thread Ludovic Brenta

Package: src:gnat-4.9
Version: 4.9-20140218-1
Severity: serious

Symptoms from the buildd log:

/«PKGBUILDDIR»/build/./gcc/xgcc -B/«PKGBUILDDIR»/build/./gcc/ -c -g -O2 
-W -Wall -gnatpg -nostdinc  a-direct.adb -o a-direct.o

raised STORAGE_ERROR : stack overflow or erroneous memory access
make[7]: *** [a-direct.o] Error 1
make[7]: Leaving directory 
`/«PKGBUILDDIR»/build/gcc/ada/rts-static-zcx'

make[6]: *** [rts-static-zcx/libgnat.a] Error 2
make[6]: Leaving directory `/«PKGBUILDDIR»/build/gcc/ada'
make[5]: *** [gnatlib-static-zcx] Error 2
make[5]: Leaving directory `/«PKGBUILDDIR»/build/gcc/ada'
make[4]: *** [gnatlib-static-zcx] Error 2
make[4]: *** Waiting for unfinished jobs


/«PKGBUILDDIR»/build/./gcc/xgcc -B/«PKGBUILDDIR»/build/./gcc/ -c -g -O2 
-W -Wall -gnatpg -nostdinc  a-direct.adb -o a-direct.o

raised STORAGE_ERROR : stack overflow or erroneous memory access
make[7]: *** [a-direct.o] Error 1
make[7]: *** Waiting for unfinished jobs


/«PKGBUILDDIR»/build/./gcc/xgcc -B/«PKGBUILDDIR»/build/./gcc/ -c -g -O2 
-fPIC  -W -Wall -gnatpg -nostdinc -fPIC  a-direct.adb -o a-direct.o

raised STORAGE_ERROR : stack overflow or erroneous memory access
make[7]: *** [a-direct.o] Error 1
make[7]: *** Waiting for unfinished jobs




/«PKGBUILDDIR»/build/./gcc/xgcc -B/«PKGBUILDDIR»/build/./gcc/ -c -g -O2 
-W -Wall -gnatpg -nostdinc -g -O1 -fno-inline \

  -fno-toplevel-reorder  a-except.adb -o a-except.o
raised STORAGE_ERROR : stack overflow or erroneous memory access
make[7]: *** [a-except.o] Error 1
make[7]: Leaving directory 
`/«PKGBUILDDIR»/build/gcc/ada/rts-static-sjlj'

make[6]: *** [rts-static-sjlj/libgnat.a] Error 2
make[6]: Leaving directory `/«PKGBUILDDIR»/build/gcc/ada'
make[5]: *** [gnatlib-static-sjlj] Error 2
make[5]: Leaving directory `/«PKGBUILDDIR»/build/gcc/ada'
make[4]: *** [gnatlib-static-sjlj] Error 2

/«PKGBUILDDIR»/build/./gcc/xgcc -B/«PKGBUILDDIR»/build/./gcc/ -c -g -O2 
-fPIC  -W -Wall -gnatpg -nostdinc -fPIC -g -O1 -fno-inline \

  -fno-toplevel-reorder  a-except.adb -o a-except.o
raised STORAGE_ERROR : stack overflow or erroneous memory access
make[7]: *** [a-except.o] Error 1
make[7]: Leaving directory 
`/«PKGBUILDDIR»/build/gcc/ada/rts-shared-zcx'

make[6]: *** [rts-shared-zcx/libgnat-4.9.so] Error 2
make[6]: Leaving directory `/«PKGBUILDDIR»/build/gcc/ada'
make[5]: *** [gnatlib-shared-zcx] Error 2
make[5]: Leaving directory `/«PKGBUILDDIR»/build/gcc/ada'
make[4]: *** [gnatlib-shared-zcx] Error 2
make[4]: Leaving directory `/«PKGBUILDDIR»/build/libada'
make[3]: *** [all-libada] Error 2
make[3]: Leaving directory `/«PKGBUILDDIR»/build'
make[2]: *** [bootstrap] Error 2
make[2]: Leaving directory `/«PKGBUILDDIR»/build'

Note that none of these exceptions are raised when using
the bootstrap compiler (gnat-4.6) to compile a-except.adb.

--
Ludovic Brenta.


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org