This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/64755] New: Error in optimization with std::array
- From: "nubcrack at yahoo dot es" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 23 Jan 2015 21:30:33 +0000
- Subject: [Bug c++/64755] New: Error in optimization with std::array
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64755
Bug ID: 64755
Summary: Error in optimization with std::array
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nubcrack at yahoo dot es
Created attachment 34556
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34556&action=edit
They are 3 files bug.cpp (contain the code to compile), bug.O1 and bug.O2
(contain the assembly code generated by g++) witch return 0 in O1 or -1 in O2..
The code provide access to emulated registers of x86:
-class basic_reg represent an x86 register. Could be registers that have access
to higher and lower part (ex: eax -> _,ax -> ah,al). Or registers that don't
need this access (ex: al, ah).
-class basic_registers represent a container of basic_reg (ex: 8 general
purpose registers in x86).
-class basic_registry_wrapper contain the address of the registers of size
16bits or 32bits of the container in class basic_registers and provide easy
access to specific register (ex: eax).
The code in main is a piece of unit test, trying to test that when registers
are modified by basic_registry_wrapper and accessed by basic_registers the
value accessed is the same (even if different parts of the registers are
request or set. Setting AX need to modify the lower part of EAX.
In the attach files .O1 (generated with g++ -S -O1 -o .O1 .cpp) return 0 (no
error) as expected and the .O2 (generated with g++ -S -O2 -o .O2 .cpp) return
-1 (error).
In the two assembly output the code is optimized away completely. When the
default constructor of basic_registers (line "basic_registers() :
m_registers{0} {}") is removed the code work in O1, O2 and O3.