[nvptx] Fix dummy location in gen_comment
authorTom de Vries <tdevries@suse.de>
Wed, 23 Feb 2022 08:33:33 +0000 (09:33 +0100)
committerTom de Vries <tdevries@suse.de>
Thu, 24 Feb 2022 08:17:27 +0000 (09:17 +0100)
commit7862f6ccd85a001e4d70abb00bb95d8c7846ba80
tree96ffe62e629462f9c2db31411a0f86c29e569ee0
parentffb2c67170768d5aa2d84a143405da658930e9b0
[nvptx] Fix dummy location in gen_comment

I committed "[nvptx] Add -mptx-comment", but tested it in combination with the
proposed "[final] Handle compiler-generated asm insn" (
https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590721.html ), so
by itself the commit introduced some regressions:
...
FAIL: gcc.dg/20020426-2.c (internal compiler error: Segmentation fault)
FAIL: gcc.dg/analyzer/zlib-3.c (internal compiler error: Segmentation fault)
FAIL: gcc.dg/pr101223.c (internal compiler error: Segmentation fault)
FAIL: gcc.dg/torture/pr80764.c   -O2  (internal compiler error: Segmentation fault)
...

There are due to cfun->function_start_locus == 0.

Fix these by using DECL_SOURCE_LOCATION (cfun->decl) instead.

Tested on nvptx.

gcc/ChangeLog:

2022-02-23  Tom de Vries  <tdevries@suse.de>

* config/nvptx/nvptx.cc (gen_comment): Use
DECL_SOURCE_LOCATION (cfun->decl) instead of cfun->function_start_locus.
gcc/config/nvptx/nvptx.cc