public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60948] New: incorrect debug info for reference type of function parameters
@ 2014-04-24 3:46 chihin.ko at oracle dot com
2014-04-24 5:54 ` [Bug c++/60948] " jakub at gcc dot gnu.org
2014-04-24 5:57 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: chihin.ko at oracle dot com @ 2014-04-24 3:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60948
Bug ID: 60948
Summary: incorrect debug info for reference type of function
parameters
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: chihin.ko at oracle dot com
cat t.cc
#include <stdio.h>
int f(int &r) {
r = r + 1;
return r;
}
main(void) {
int j = 99;
int i = 99;
printf("i = %d\n",i);
printf("f(i) = %d\n",f(i));
printf("i = %d\n",i);
return 0;
}
(dbx) stop at 11;run
(2) stop at "calls_with_refs.cc":11
Running: a.out
(process id 14632)
stopped in main at line 11 in file "calls_with_refs.cc"
11 int i = 99;
(dbx) call f(33) <== should have errmsg "dbx: The ref (&) parameters to `f'
cannot be literals"
-------------------------------------------------------------------------
this is due to g++ generate wrong debug info
for function f(int &), there is an extra "const" , f(const int &),
if there is no "const", then call "f" with constant e.g. f(33), is illegal,
if there is "const", then "call f(33)" is legal.
--------------------------------------------------------------------
There is an extra DW_TAG_const_type for parameter "r" of function "f"
< 2><0x00000482> DW_TAG_formal_parameter
DW_AT_name "r"
DW_AT_decl_line 0x00000003
DW_AT_type <0x0000048f>
...
...
< 1><0x0000048f> DW_TAG_const_type <== should not have this TAG
DW_AT_type <0x00000494>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/60948] incorrect debug info for reference type of function parameters
2014-04-24 3:46 [Bug c++/60948] New: incorrect debug info for reference type of function parameters chihin.ko at oracle dot com
@ 2014-04-24 5:54 ` jakub at gcc dot gnu.org
2014-04-24 5:57 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-04-24 5:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60948
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
DW_TAG_const_type -> DW_TAG_reference_type -> DW_TAG_base_type (int)
is not IMHO the same thing as const int &, but int & const, though the fact
that the reference is constant is redundant, all references are.
const int & would be
DW_TAG_reference_type -> DW_TAG_const_type -> DW_TAG_base_type (int)
or redundantly:
DW_TAG_const_type -> DW_TAG_reference_type -> DW_TAG_const_type ->
DW_TAG_base_type (int)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/60948] incorrect debug info for reference type of function parameters
2014-04-24 3:46 [Bug c++/60948] New: incorrect debug info for reference type of function parameters chihin.ko at oracle dot com
2014-04-24 5:54 ` [Bug c++/60948] " jakub at gcc dot gnu.org
@ 2014-04-24 5:57 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-04-24 5:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60948
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 55641.
*** This bug has been marked as a duplicate of bug 55641 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-24 5:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-24 3:46 [Bug c++/60948] New: incorrect debug info for reference type of function parameters chihin.ko at oracle dot com
2014-04-24 5:54 ` [Bug c++/60948] " jakub at gcc dot gnu.org
2014-04-24 5:57 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).