I have included the configure, and build command below. This seems really easy to reproduce, create and array of integer values (I am unsure if integer is significant) the upper bound of which is determined by a function call declare the array as volatile +===========================GNAT BUG DETECTED==============================+ | 4.0.2 (i686-pc-cygwin) in tree_low_cst, at tree.c:3850 | | Error detected at mfd_transmitter.2.ada:540:9 | | Please submit a bug report; see http://gcc.gnu.org/bugs.html. | | Include the entire contents of this bug box in the report. | | Include the exact gcc or gnatmake command that you entered. | | Also include sources listed below in gnatchop format | | (concatenated together with no headers between files). | +==========================================================================+ This error can be avoided by using a fixed size array or removing the volatile from the array. gcc -c -g -fstack-check -gnata -gnato -gnatE -gnatf -I- -gnatA -x ada project_top.adb $ gcc -v Using built-in specs. Target: i686-pc-cygwin Configured with: ../gcc-4.0.2/configure --enable-languages=ada --disable-win32-registry Thread model: single gcc version 4.0.2
Could you please send full sources to reproduce this problem ? thanks. Arno
(In reply to comment #1) > Could you please send full sources to reproduce this problem ? thanks. > Arno Arno, what follows is a simple bit of code which causes the assertion failure described in tree.c, In constructing this it became apparent that the bug report should read use of volatile array, within a record, with bounds determined at run time. I hope this clarifies the issue. ---scratch.ada-------- with system; with Interfaces.c; procedure scratch is -- to get a value for the upper bound of the array type my_Integer is range -2147483648 .. 2147483647; for my_Integer'Size use 32; function GetArrayUpperBound return my_integer is begin return 2; end GetArrayUpperBound; some_value : my_integer := GetArrayUpperBound; type Gp_Element_Type is record Element : Interfaces.C.Unsigned; end record; type some_type is array (1 .. some_value ) of Gp_Element_Type; type Aligned_Some_Type is record Value : aliased some_type; end record; for Aligned_Some_Type'Alignment use 8; an_aligned_type : aligned_Some_Type; my_address : system.address; -- remember volatile too pragma Volatile (an_aligned_type); begin my_address := an_aligned_type.value( 1 )'address; end scratch;
Thanks, reopening. Confirmed on trunk with simple command: $ gcc -c scratch.adb +===========================GNAT BUG DETECTED==============================+ | 4.2.0 20060210 (experimental) (i686-pc-linux-gnu) GCC error: | | in tree_low_cst, at tree.c:4420 | | Error detected at scratch.adb:50:13 | [...]
I just did a fresh Gcc build today this no longer appears to be a problem URL: svn://gcc.gnu.org/svn/gcc/trunk Repository Root: svn://gcc.gnu.org/svn/gcc Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4 Revision: 117904 Node Kind: directory Schedule: normal Last Changed Author: fxcoudert Last Changed Rev: 117904 Last Changed Date: 2006-10-20 07:52:56 -0400 (Fri, 20 Oct 2006) Properties Last Updated: 2006-10-20 09:33:34 -0400 (Fri, 20 Oct 2006) [jcreem@timone mat_test]$ gcc -c scratch.adb [jcreem@timone mat_test]$ gcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc/configure --disable-checking --enable-languages=c,fortran,ada --prefix=/home/jcreem/local Thread model: posix gcc version 4.2.0 20061020 (experimental)
You built GCC with --disable-checking, which is not a good idea (in particular with GCC >= 4.1, at a minimum you should use --enable-checking=release). this bug is still present in trunk: << gcc -c scratch.adb +===========================GNAT BUG DETECTED==============================+ | 4.3.0 20061101 (experimental) (i686-pc-linux-gnu) GCC error: | | in force_constant_size, at gimplify.c:708 | | Error detected around scratch.adb:47 | >>
> this bug is still present in trunk: Right. It may already be fixed in our internal tree though.
"included in the description" is not a target.
Testing fix.
Subject: Bug number PR middle-end/26306 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00251.html
Subject: Bug 26306 Author: ebotcazou Date: Thu Nov 16 21:25:16 2006 New Revision: 118900 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118900 Log: PR middle-end/26306 * gimplify.c (gimplify_expr): Only force a load for references to non-BLKmode volatile values. * doc/implement-c.texi (Qualifiers implementation): Document the interpretation of what a volatile access is. * doc/extend.texi (C++ Extensions): Rework same documentation. Added: trunk/gcc/testsuite/gnat.dg/volatile_aggregate.adb Modified: trunk/gcc/ChangeLog trunk/gcc/doc/extend.texi trunk/gcc/doc/implement-c.texi trunk/gcc/gimplify.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 26306 Author: ebotcazou Date: Thu Nov 16 21:27:32 2006 New Revision: 118901 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118901 Log: PR middle-end/26306 * gimplify.c (gimplify_expr): Only force a load for references to non-BLKmode volatile values. * doc/implement-c.texi (Qualifiers implementation): Document the interpretation of what a volatile access is. * doc/extend.texi (C++ Extensions): Rework same documentation. Added: branches/gcc-4_2-branch/gcc/testsuite/gnat.dg/volatile_aggregate.adb Modified: branches/gcc-4_2-branch/gcc/ChangeLog branches/gcc-4_2-branch/gcc/doc/extend.texi branches/gcc-4_2-branch/gcc/doc/implement-c.texi branches/gcc-4_2-branch/gcc/gimplify.c branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
Subject: Bug 26306 Author: ebotcazou Date: Thu Nov 16 21:30:22 2006 New Revision: 118902 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118902 Log: PR middle-end/26306 * gimplify.c (gimplify_expr): Only force a load for references to non-BLKmode volatile values. * doc/implement-c.texi (Qualifiers implementation): Document the interpretation of what a volatile access is. * doc/extend.texi (C++ Extensions): Rework same documentation. Modified: branches/gcc-4_1-branch/gcc/ChangeLog branches/gcc-4_1-branch/gcc/doc/extend.texi branches/gcc-4_1-branch/gcc/doc/implement-c.texi branches/gcc-4_1-branch/gcc/gimplify.c
Fixed in 4.1.2 and later.