From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29322 invoked by alias); 3 Dec 2005 17:52:35 -0000 Received: (qmail 29303 invoked by uid 48); 3 Dec 2005 17:52:33 -0000 Date: Sat, 03 Dec 2005 17:52:00 -0000 Subject: [Bug ada/25245] New: Discriminant is left uninitialized. X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "listor1 dot rombobeorn at comhem dot se" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2005-12/txt/msg00324.txt.bz2 List-Id: The attached file uninitialized_field.adb demonstrates a case where a discriminant of a record isn't initialized. I compile and run it like this: $ gnatmake uninitialized_field.adb gcc -c uninitialized_field.adb gnatbind -x uninitialized_field.ali gnatlink uninitialized_field.ali $ ./uninitialized_field Initialized with Unified_Encoding_Record aggregate: With predefined "=" - A1a and A2a: equal Initialized with Character_Encoding aggregate: With predefined "=" - A1b and A2b: not equal With redefined "=" - B1c and B2c: equal OS of A1a: LINUX OS of A2a: LINUX OS of A1b: OS2 OS of A2b: raised CONSTRAINT_ERROR : uninitialized_field.adb:117 invalid data Correct output would be: Initialized with Unified_Encoding_Record aggregate: With predefined "=" - A1a and A2a: equal Initialized with Character_Encoding aggregate: With predefined "=" - A1b and A2b: equal With redefined "=" - B1c and B2c: equal OS of A1a: LINUX OS of A2a: LINUX OS of A1b: LINUX OS of A2b: LINUX The other attached file, convert_to_pointer.ada, contains relevant parts of the code in uninitialized_field.adb, but here the declarations are in a package and are referenced from the main program. This causes a very strange error message: $ gnatmake convert_to_pointer_package.ads gcc -c convert_to_pointer_package.ads $ LANG=en_US gnatmake convert_to_pointer_main.adb gcc -c convert_to_pointer_main.adb convert_to_pointer_package.ads: In function `Convert_To_Pointer_Main': convert_to_pointer_package.ads:37: error: cannot convert to a pointer type gnatmake: "convert_to_pointer_main.adb" compilation error Both these test cases fail on all of the following compilers: $ LANG=C gcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.1-20051112/configure --prefix=/home/bjorn/ada/gcc-4.1-20051112-inst --enable-libada --enable-languages=ada,c Thread model: posix gcc version 4.1.0 20051112 (experimental) $ LANG=C gcc -v Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=i386-redhat-linux Thread model: posix gcc version 4.0.2 20051125 (Red Hat 4.0.2-8) $ gcc -v Reading specs from /home/bjorn/ada/gcc-3.4.0-inst/lib/gcc/i686-pc-linux-gnu/3.4.0/specs Configured with: /home/bjorn/ada/gcc-3.4.0/configure --prefix=/home/bjorn/ada/gcc-3.4.0-inst Thread model: posix gcc version 3.4.0 Note: I originally submitted these test cases to bug 17160, but that bug has been fixed, and indeed that ICE no longer happens. These tests still fail though, so I'm making a separate report for them. -- Summary: Discriminant is left uninitialized. Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: listor1 dot rombobeorn at comhem dot se GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25245