[antlr-interest] C++, RefAST, &&, left-to-right eval: gcc bug?

Paul Johnson gt54-antlr at cyconix.com
Tue Dec 6 03:21:16 PST 2005


I've got what appears to be a gcc bug (v3.4.3) when using the RefAST 
class with an && operator:

    // this calls 'getRvalue' and crashes if 'node' is '0'
    RefAST node = getFirstChild();
    if(node && !VCAST(node)->getRvalue()) {
      ...
    }

    // but this works as expected
    RefAST node = getFirstChild();
    if(node) {
       if(!VCAST(node)->getRvalue()) {
          ...
       }
    }

I use the first form a lot and it only seems to be a problem in one 
place. I've had a look at gcc's bugzilla, but this doesn't seem to be 
covered. Has anyone else seen this and have a workaround?

Thanks -

Paul



More information about the antlr-interest mailing list