Some builtin macros are more builtin than others. In particular, front-end builtin macros are weaker than libcpp builtin macros, and should not be processed with the libcpp builtin tools.
Index: gcc/testsuite/ChangeLog.pph 2011-06-08 Lawrence Crowl <cr...@google.com> * g++.dg/pph/c120060625-1.h: Make expected pass. * g++.dg/pph/c120060625-1.cc: Make expected pass. Index: libcpp/ChangeLog.pph 2011-06-08 Lawrence Crowl <cr...@google.com> * symtab.c (lt_query_macro): Querying "user builtin" macros should not call _cpp_builtin_macro_text. Instead, call regular query, but first let the front end define the value. Index: gcc/testsuite/g++.dg/pph/c120060625-1.cc =================================================================== --- gcc/testsuite/g++.dg/pph/c120060625-1.cc (revision 174789) +++ gcc/testsuite/g++.dg/pph/c120060625-1.cc (working copy) @@ -1,5 +1 @@ -// { dg-xfail-if "ICE" { "*-*-*" } { "-fpph-map=pph.map" } } -// { dg-bogus "c120060625-1.h:14:22: internal compiler error: invalid built-in macro .__FLT_MAX__." "" { xfail *-*-* } 0 } -// { dg-prune-output "In file included from " } - #include "c120060625-1.h" Index: gcc/testsuite/g++.dg/pph/c120060625-1.h =================================================================== --- gcc/testsuite/g++.dg/pph/c120060625-1.h (revision 174789) +++ gcc/testsuite/g++.dg/pph/c120060625-1.h (working copy) @@ -1,6 +1,3 @@ -// { dg-xfail-if "ICE" { "*-*-*" } { "-fpph-map=pph.map" } } -// { dg-bogus "c120060625-1.h:14:22: internal compiler error: invalid built-in macro .__FLT_MAX__." "" { xfail *-*-* } 0 } - #ifndef __PPH_GUARD_H #define __PPH_GUARD_H Index: libcpp/symtab.c =================================================================== --- libcpp/symtab.c (revision 174789) +++ libcpp/symtab.c (working copy) @@ -494,7 +494,8 @@ static const char * lt_query_macro (cpp_reader *reader, cpp_hashnode *cpp_node) { const char *definition = NULL; - if (cpp_node->flags & NODE_BUILTIN) + if ((cpp_node->flags & NODE_BUILTIN) + && cpp_node->value.builtin < BT_FIRST_USER) { const char *str = (const char *)cpp_node->ident.str; if ( strcmp(str, "__DATE__") == 0 @@ -527,6 +528,8 @@ lt_query_macro (cpp_reader *reader, cpp_ else { char c; + if ((cpp_node->flags & NODE_BUILTIN) && reader->cb.user_builtin_macro) + reader->cb.user_builtin_macro (reader, cpp_node); definition = (const char *) cpp_macro_definition (reader, cpp_node); /* Skip over the macro name within the definition. */ c = *definition; -- This patch is available for review at http://codereview.appspot.com/4575055