* [PATCH] New uninit testcase
@ 2022-08-23 12:30 Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-08-23 12:30 UTC (permalink / raw)
To: gcc-patches
I've reduced the following which doesn't seem covered in a good enough
way in the testsuite.
Pushed.
* gcc.dg/uninit-pred-10.c: New testcase.
---
gcc/testsuite/gcc.dg/uninit-pred-10.c | 36 +++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 gcc/testsuite/gcc.dg/uninit-pred-10.c
diff --git a/gcc/testsuite/gcc.dg/uninit-pred-10.c b/gcc/testsuite/gcc.dg/uninit-pred-10.c
new file mode 100644
index 00000000000..468b4d3ad4b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pred-10.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized" } */
+
+enum demangle_component_type {
+ DEMANGLE_COMPONENT_NAME,
+ DEMANGLE_COMPONENT_REFERENCE
+};
+struct demangle_component {
+ enum demangle_component_type type;
+} d_print_comp_inner_mod_inner, *d_print_comp_inner_dc;
+struct d_print_mod {
+ struct d_print_mod *next;
+};
+struct d_print_info {
+ int templates;
+ struct d_print_mod *modifiers;
+};
+void d_print_comp_inner(struct d_print_info *dpi)
+{
+ int saved_templates, need_template_restore = 0;
+ switch (d_print_comp_inner_dc->type) {
+ case DEMANGLE_COMPONENT_NAME:
+ goto modifier;
+ case DEMANGLE_COMPONENT_REFERENCE:
+ saved_templates = dpi->templates;
+ need_template_restore = 1;
+ modifier:
+ struct d_print_mod dpm;
+ dpm.next = dpi->modifiers;
+ d_print_comp_inner_mod_inner = *d_print_comp_inner_dc;
+ d_print_comp_inner(dpi);
+ dpi->modifiers = dpm.next;
+ if (need_template_restore)
+ dpi->templates = saved_templates; /* { dg-bogus "uninitialized" } */
+ }
+}
--
2.35.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] New uninit testcase
@ 2022-08-23 12:30 Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-08-23 12:30 UTC (permalink / raw)
To: gcc-patches
I've reduced the following which doesn't seem covered in a good enough
way in the testsuite.
Pushed.
* gcc.dg/uninit-pred-10.c: New testcase.
---
gcc/testsuite/gcc.dg/uninit-pred-10.c | 36 +++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 gcc/testsuite/gcc.dg/uninit-pred-10.c
diff --git a/gcc/testsuite/gcc.dg/uninit-pred-10.c b/gcc/testsuite/gcc.dg/uninit-pred-10.c
new file mode 100644
index 00000000000..468b4d3ad4b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pred-10.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized" } */
+
+enum demangle_component_type {
+ DEMANGLE_COMPONENT_NAME,
+ DEMANGLE_COMPONENT_REFERENCE
+};
+struct demangle_component {
+ enum demangle_component_type type;
+} d_print_comp_inner_mod_inner, *d_print_comp_inner_dc;
+struct d_print_mod {
+ struct d_print_mod *next;
+};
+struct d_print_info {
+ int templates;
+ struct d_print_mod *modifiers;
+};
+void d_print_comp_inner(struct d_print_info *dpi)
+{
+ int saved_templates, need_template_restore = 0;
+ switch (d_print_comp_inner_dc->type) {
+ case DEMANGLE_COMPONENT_NAME:
+ goto modifier;
+ case DEMANGLE_COMPONENT_REFERENCE:
+ saved_templates = dpi->templates;
+ need_template_restore = 1;
+ modifier:
+ struct d_print_mod dpm;
+ dpm.next = dpi->modifiers;
+ d_print_comp_inner_mod_inner = *d_print_comp_inner_dc;
+ d_print_comp_inner(dpi);
+ dpi->modifiers = dpm.next;
+ if (need_template_restore)
+ dpi->templates = saved_templates; /* { dg-bogus "uninitialized" } */
+ }
+}
--
2.35.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-23 12:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-23 12:30 [PATCH] New uninit testcase Richard Biener
2022-08-23 12:30 Richard Biener
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).