This is with today's cvs head gcc and cvs head gdb. I'm running on x86 FC2. The test program: #include <stdio.h> enum java_tree_index { JTI_PROMOTED_BYTE_TYPE_NODE, JTI_PROMOTED_SHORT_TYPE_NODE, JTI_PROMOTED_CHAR_TYPE_NODE, JTI_PROMOTED_BOOLEAN_TYPE_NODE, JTI_MAX }; int main() { printf ("%d\n", (int) JTI_MAX); } what happens: opsy. gcc -g -o zz zz.c opsy. ~/gnu/baseline-gdb/install/bin/gdb zz GNU gdb 6.3.50.20050811-cvs Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1". (gdb) b main Breakpoint 1 at 0x8048380: file zz.c, line 15. (gdb) r Starting program: /tmp/zz Breakpoint 1, main () at zz.c:15 15 printf ("%d\n", (int) JTI_MAX); (gdb) p JTI_MAX No symbol "JTI_MAX" in current context. I think it should know the value of JTI_MAX here. I know this used to work; for instance it works fine with the system compiler on FC2 - gcc (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7) (FWIW this bug is a big impediment to debugging gcj.)
Confirmed, another -feliminate-unused-debug-types bug. a regression from 3.3.3.
Leaving as P2; we should definitely fix this.
What the heck...death by dwarf. I'll take a look at this.
This issue will not be resolved in GCC 4.1.0; retargeted at GCC 4.1.1.
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
This still fails on the mainline.
This still fails because it hasn't been fixed ;-). My patch for -feliminate-unused-debug-types only handled casts. It needs further front-end work to handle enums. At least the infrastructure is in place for the front-end work.
Hmm. What's happening here is that we set TREE_USED on the enumerator, but not on the type. The enumerator never gets output, because the type is not output. It would probably be a strict improvement to add the type to the used_types hash table like we now do for casts. However, that is not a great solution either. It won't cause the enum to be emitted for "static int x = JTI_MAX;" at the global scope even if x is emitted. We really need a more general solution to this...
Meanwhile, I'm testing a patch to treat them just as well as we treat casts.
Subject: Bug 23336 Author: drow Date: Tue Aug 1 14:23:58 2006 New Revision: 115853 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115853 Log: gcc/ PR debug/23336 * c-typeck.c (build_external_type): Mark used enum types. * dwarf2out.c (dwarf2out_abstract_function): Save and restore cfun also. (gen_subprogram_die): Whitespace fix. gcc/cp/ PR debug/23336 * pt.c (tsubst_copy_and_build): Mark used enum types. * semantics.c (finish_id_expression): Likewise. gcc/testsuite/ PR debug/23336 * lib/gcc-dg.exp (gcc-dg-debug-runtest): Suppress new tests at -g1. * gcc.dg/debug/enum-1.c, g++.dg/debug/enum-1.C, g++.dg/debug/enum-2.C: New. Added: trunk/gcc/testsuite/g++.dg/debug/enum-1.C trunk/gcc/testsuite/g++.dg/debug/enum-2.C trunk/gcc/testsuite/gcc.dg/debug/enum-1.c Modified: trunk/gcc/ChangeLog trunk/gcc/c-typeck.c trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/cp/semantics.c trunk/gcc/dwarf2out.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/lib/gcc-dg.exp
Fixed for 4.2.
I don't care about 4.0/4.1 at this date.
Closing 4.1 branch.