delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/07/19/21:15:09

From: msalazar AT access DOT digex DOT net (Mark Salazar)
Subject: egcs1.0.2 in-class function screws switch table
19 Jul 1998 21:15:09 -0700 :
Message-ID: <Pine.SUN.3.96.980719165008.23813A-100000.cygnus.gnu-win32@access4.digex.net>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

While debugging some code I discovered that my egcs1.0.2 mingw32 compiler
is generating an invalid jump-address table for a switch construct if the
function in question is defined in-class.  Ie, this works:
	class Child2: public Parent {
		int textstuff (int w) ;
	};
	int Child2::textstuff(int w){
		switch(w){
		case 0: doSomething(1); break;
		case 1: doSomething(2); break;
		}
		return(1);
	}

but this doesn't:
	class Child2: public Parent {
		int textstuff (int w) {
			switch(w){
			case 0: doSomething(1); break;
			case 1: doSomething(2); break;
			}
			return(1);
		};
	};


After much gdb'ing I determined the problem was the compiler-generated
jump table for the switch statement.  It's garbage for the case that
doesn't work.

Has anyone seen this before?


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019