From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3534 invoked by alias); 21 Jan 2006 08:17:37 -0000 Received: (qmail 3469 invoked by uid 48); 21 Jan 2006 08:17:34 -0000 Date: Sat, 21 Jan 2006 08:17:00 -0000 Message-ID: <20060121081734.3468.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug rtl-optimization/25791] -O2 execution fails, -O and -g work In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dick_guertin at yahoo dot com" 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: 2006-01/txt/msg02181.txt.bz2 List-Id: ------- Comment #27 from dick_guertin at yahoo dot com 2006-01-21 08:17 ------- Referring to Comment #26, these static objects are NOT all of one type, but they share a common typedef struct, something like a union of different types that share the same space. Each type is a constructor allowing initialization to occur different ways. NKW and 'struct sckw" are two examples, and both appear in Comment #25. What I finally did was add a pointer to each object that points to another object, usually of its own type. But the pointer can by cast so that a different type can be referenced. Thus the pointer in NKW can be cast as an NKW pointer even though it points to a 'struct sckw' object, and vice-versa. To make this work, I had to reverse the declaration order so that the last is declared first, and the first is declared last. So the new 'first' (old 'last') has a zero pointer. Those which follow point back to the one before it. This does two things: it guarantees every object is referenced so it isn't eliminated, and they can now be placed anywhere in memory. Instead of ticking through them with 'kwp += 1;', I navigate thru them with 'kwp = kwp->next;'. The chain stops when kwp goes to zero (first declared, last examined). In cases where an array of like-kind objects was initialized, I simply point down the list, such as: static NKW item[] = { SCKW_TOKEN("IF",xif,NKWFSET+NKWFCRTN, &item[1]), SCKW_TOKEN("SHOW",show,NKWFSET+NKWFCRTN, &item[2]), SCKW_TOKEN("SET",set,NKWFSET+NKWFCRTN, (NKW*)0) }; I'm documenting this just in case it can be useful to someone else with a similar problem. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25791