Bug 1600886 - GCC/GNAT fails to optimize access to packed array
Summary: GCC/GNAT fails to optimize access to packed array
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 28
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-13 09:44 UTC by Maxim Reznik
Modified: 2018-08-10 14:35 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-08-10 14:35:02 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
reproducer (932 bytes, text/plain)
2018-07-13 09:44 UTC, Maxim Reznik
no flags Details


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 86514 0 None None None 2018-07-13 10:53:56 UTC

Description Maxim Reznik 2018-07-13 09:44:59 UTC
Created attachment 1458691 [details]
reproducer

Description of problem:

Ada compiler performs incorrect optimization of operations on a packed array of Booleans.

Version-Release number of selected component (if applicable):

gcc version 8.1.1 20180502 (Red Hat 8.1.1-1) (GCC)
RPM: gcc-gnat-8.1.1-1.fc28.x86_64

How reproducible:
1. Install Ada compiler dnf --assumeyes install gcc-gnat
2. Compile and run attached code with optimization is on (-O1).
3. Without optimization (-O0) the example works well - without exception.

Actual results:

[max@4803f13cbde8 tmp]$ gnatmake -O1 ts_00021.adb 
gcc -c -O1 ts_00021.adb
gnatbind -x ts_00021.ali
gnatlink ts_00021.ali -O1
[max@4803f13cbde8 tmp]$ ./ts_00021 

raised PROGRAM_ERROR : ts_00021.adb:30 explicit raise

Expected results:

gnatmake -O0 ts_00021.adb 
gcc -c -O0 ts_00021.adb
gnatbind -x ts_00021.ali
gnatlink ts_00021.ali -O0
[max@4803f13cbde8 tmp]$ ./ts_00021 
[max@4803f13cbde8 tmp]$

Additional info:

Comment 1 Maxim Reznik 2018-07-13 10:53:39 UTC
I've checked gcc 9 snapshot and bug is still there. I've filled upstream bug report

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

Comment 2 Marek Polacek 2018-08-10 14:35:02 UTC
Fixed in 8.2.1-1.


Note You need to log in before you can comment on or make changes to this bug.