public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/96663] New: Composite type default 'Read attribute does not perform validity checking for defaulted components
@ 2020-08-17 19:18 mrhatch97 at gmail dot com
  2024-01-09 11:06 ` [Bug ada/96663] " ebotcazou at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: mrhatch97 at gmail dot com @ 2020-08-17 19:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96663

            Bug ID: 96663
           Summary: Composite type default 'Read attribute does not
                    perform validity checking for defaulted components
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mrhatch97 at gmail dot com
  Target Milestone: ---

Created attachment 49070
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49070&action=edit
Source file for the program demonstrating the bug

System type: Windows x64 (MINGW provided by MSYS2). Target string is
"x86_64-w64-mingw32"

Configured with: ../gcc-10.2.0/configure --prefix=/mingw64
--with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
--with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include
--libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64
--with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++
--enable-shared --enable-static --enable-libatomic --enable-threads=posix
--enable-graphite --enable-fully-dynamic-string
--enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes
--disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check
--enable-lto --enable-libgomp --disable-multilib --enable-checking=release
--disable-rpath --disable-win32-registry --disable-nls --disable-werror
--disable-symvers --disable-plugin --with-libiconv --with-system-zlib
--with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64
--with-isl=/mingw64 --with-pkgversion='Rev1, Built by MSYS2 project'
--with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as
--with-gnu-ld

Invoked by: gcc -c -gnatVa parse.adb (forwarded from gnat make)

Expected behavior: When run with a text file in the same directory as the
executable with the name "value.txt" containing a single character 'a', the
output "Parse FAILED" should be output to stdout.

This should occur because the default implementation of the 'Read attribute
should raise Constraint_error in the given setup. This behavior is prescribed
by the Ada 2012 Reference Manual (Section 13.13.2, paragraph 35).

The 'Read attribute is invoked for a composite type which contains a single
scalar component with an implicit initial value of 65. The value read from the
file is 'a' (97) which is outside the subtype range of the scalar component.
According to the ARM, Constraint_Error should be raised.

Actual behavior: Under the described circumstances, the output "Parse OK" is
given, followed by "Parsed value is INVALID". No exception is raised, and the
parsed value does not belong to its subtype.

Note: I added -gnatVa to the compile flags to see if that would affect whether
it performed the validity checking, but it didn't change the outcome.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug ada/96663] Composite type default 'Read attribute does not perform validity checking for defaulted components
  2020-08-17 19:18 [Bug ada/96663] New: Composite type default 'Read attribute does not perform validity checking for defaulted components mrhatch97 at gmail dot com
@ 2024-01-09 11:06 ` ebotcazou at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-01-09 11:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96663

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |12.0
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |ebotcazou at gcc dot gnu.org

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Fixed in GCC 12 and later (even without -gnatVa):

eric@fomalhaut:~/build/gcc/native> ~/install/gcc-12/bin/gnatmake p
gcc -c p.adb
gnatbind -x p.ali
gnatlink p.ali
eric@fomalhaut:~/build/gcc/native> ./p
Parse FAILED

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-09 11:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17 19:18 [Bug ada/96663] New: Composite type default 'Read attribute does not perform validity checking for defaulted components mrhatch97 at gmail dot com
2024-01-09 11:06 ` [Bug ada/96663] " ebotcazou at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).