------- Comment #47 from danglin at gcc dot gnu dot org  2009-03-23 20:39 
-------
I hate PCH!

The reason a small change inhibits PCH file loading is the following:

  /* If the text segment was not loaded at the same address as it was
     when the PCH file was created, function pointers loaded from the
     PCH will not be valid.  We could in theory remap all the function
     pointers, but no support for that exists at present.
     Since we have the same executable, it should only be necessary to
     check one function.  */
  if (v.pch_init != &pch_init)
    {
      if (cpp_get_options (pfile)->warn_invalid_pch)
        cpp_error (pfile, CPP_DL_WARNING,
                   "%s: had text segment at different address", name);
      return 2;
    }

Since I wasn't rebuilding the libstdc++ PCH files when I hacked expr.c and
rebuilt cc1plus, I was effectively disabling PCH.

As a side note, the comparison of v.pch_init and &pch_init is dangerous
on targets that use function descriptors.  The value v.pch_init was
recorded by a different binary, so it could point to garbage in the binary
performing the check.

So, we are left with the original PCH bug.  Is the missing DECL_VALUE_EXPR
expected for PCH data?   


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39355

Reply via email to