diff options
-rw-r--r-- | bfd/dwarf2.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 88335cb..a207665 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -2044,19 +2044,16 @@ concat_filename (struct line_info_table *table, unsigned int file) char *subdir_name = NULL; char *name; size_t len; - - if (table->files[file].dir - /* PR 17512: file: 0317e960. */ - && table->files[file].dir - <= (table->use_dir_and_file_0 ? table->num_dirs - 1 : table->num_dirs) - /* PR 17512: file: 7f3d2e4b. */ - && table->dirs != NULL) - { - if (table->use_dir_and_file_0) - subdir_name = table->dirs[table->files[file].dir]; - else - subdir_name = table->dirs[table->files[file].dir - 1]; - } + unsigned int dir = table->files[file].dir; + + if (!table->use_dir_and_file_0) + --dir; + /* Wrapping from 0 to -1u above gives the intended result with + the test below of leaving subdir_name NULL for pre-DWARF5 dir + of 0. */ + /* PR 17512: file: 0317e960, file: 7f3d2e4b. */ + if (dir < table->num_dirs) + subdir_name = table->dirs[dir]; if (!subdir_name || !IS_ABSOLUTE_PATH (subdir_name)) dir_name = table->comp_dir; |