This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

other/6613: Problem with RTX_UNCHANGING_P (again)



>Number:         6613
>Category:       other
>Synopsis:       Problem with RTX_UNCHANGING_P (again)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 09 13:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     jching@flex.com
>Release:        Verified on 3.1, 3.0.4, 3.0.2 20011002 by Jakub Jelinek
>Organization:
>Environment:
Debian/GNU-Linux IA-32, gcc 3.1
>Description:
The code below produces garbage.

But compiling without -O2 or with -DREMOVE_CTOR or -DUSE_INT
will work-around the problem.

--jc
----------------------------
#include <iostream>

struct logic
        {
        enum state_value { LO, HI, DC, Z, NVL };

        logic(state_value l = NVL)
                : state(l) { }
#ifndef REMOVE_CTOR
        logic(const logic &l)
                : state(l.state) { }
#endif

#ifdef USE_INT
        int state;
#else
        char state;
#endif
        };

const logic  LO(logic::LO);
const logic  HI(logic::HI);

void func(void);

int
main()
        {
        func();
        return 0;
        }

struct addtab
        {
        logic sum;
        logic carry;
        };
const struct addtab ADDTABLE[] =
        {
        {LO,LO},
        {HI,LO},
        {HI,LO},
        {LO,HI},
        {HI,LO},
        {LO,HI},
        {LO,HI},
        {HI,HI}
        };

void
func(void)
        {
        for (int tmp = 0; tmp < 8; ++tmp)
                {
                std::cout << (int)ADDTABLE[tmp].sum.state
                          << ","
                          << (int)ADDTABLE[tmp].carry.state
                          << std::endl;
                }
        }

>How-To-Repeat:
g++ -O2 file.cc
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]