https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100435

            Bug ID: 100435
           Summary: oddity in hash table use in libcpp
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tromey at gcc dot gnu.org
  Target Milestone: ---

I noticed that the libcpp hash tables in libcpp/files.c use
htab_hash_string, but compare filenames with filename_cmp.

This by itself is not a bug, in the sense that it can't cause
hash table corruption.

However, it seems strange, because it means that two filenames
that compare equal can hash differently, and so the hash tables
will not notice that they are "the same".

I think any problem here would most likely be a performance issue,
and only be available when either HAVE_CASE_INSENSITIVE_FILE_SYSTEM
or HAVE_DOS_BASED_FILE_SYSTEM is defined.

If this is in fact a bug, the fix would be to use filename_hash
rather than htab_hash_string in this file.  There are multiple uses
to fix.

If this is intentional, feel free to just close this bug.
I found this by reading the code while looking into something else,
and I thought it was odd enough to report; but I haven't encountered
any actual problem.

Reply via email to