From: Fred Fish <fnf@public.ninemoons.com>
To: gdb-patches@sources.redhat.com
Cc: fnf@ninemoons.com
Subject: [PATCH] Outwit compiler dead code elimination in break.exp test
Date: Sat, 29 Nov 2003 23:05:00 -0000 [thread overview]
Message-ID: <200311292305.hATN51Uj013311@fred.ninemoons.com> (raw)
2003-11-29 Fred Fish <fnf@redhat.com>
* gdb.base/break.c (globalvar): Add.
(marker1, marker2, marker3, marker4): Set globalvar.
Index: gdb.base/break.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/break.c,v
retrieving revision 1.3
diff -c -p -r1.3 break.c
*** gdb.base/break.c 13 Nov 2003 15:34:39 -0000 1.3
--- gdb.base/break.c 29 Nov 2003 22:57:41 -0000
*************** char *arg;
*** 37,54 ****
* as places to try setting breakpoints at. They are explicitly
* "one-line functions" to verify that this case works (some versions
* of gcc have or have had problems with this).
*/
#ifdef PROTOTYPES
! int marker1 (void) { return (0); }
! int marker2 (int a) { return (1); } /* set breakpoint 8 here */
! void marker3 (char *a, char *b) {}
! void marker4 (long d) {} /* set breakpoint 14 here */
#else
! int marker1 () { return (0); }
! int marker2 (a) int a; { return (1); } /* set breakpoint 9 here */
! void marker3 (a, b) char *a, *b; {}
! void marker4 (d) long d; {} /* set breakpoint 13 here */
#endif
/*
--- 37,58 ----
* as places to try setting breakpoints at. They are explicitly
* "one-line functions" to verify that this case works (some versions
* of gcc have or have had problems with this).
+ * Recent versions of gcc have gotten smart enough that they will not
+ * call functions that have no use or visible side effect, so use
+ * globalvar to outwit the compiler for a while longer.
*/
+ int globalvar;
#ifdef PROTOTYPES
! int marker1 (void) { globalvar = 1; return (0); }
! int marker2 (int a) { globalvar = 2; return (1); } /* set breakpoint 8 here */
! void marker3 (char *a, char *b) {globalvar = 3;}
! void marker4 (long d) {globalvar = 4;} /* set breakpoint 14 here */
#else
! int marker1 () { globalvar = 1; return (0); }
! int marker2 (a) int a; { globalvar = 2; return (1); } /* set breakpoint 9 here */
! void marker3 (a, b) char *a, *b; {globalvar = 3;}
! void marker4 (d) long d; {globalvar = 4;} /* set breakpoint 13 here */
#endif
/*
next reply other threads:[~2003-11-29 23:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-29 23:05 Fred Fish [this message]
2003-11-30 1:04 ` Fred Fish
2003-11-30 1:07 ` Daniel Jacobowitz
2003-11-30 1:26 ` Fred Fish
2003-12-01 0:46 ` Fred Fish
2003-12-01 14:58 ` Elena Zannoni
2003-12-01 15:30 ` Fred Fish
2003-12-01 15:46 ` Elena Zannoni
2003-12-01 16:39 ` Fred Fish
2003-12-01 14:23 ` Elena Zannoni
2003-12-01 14:44 ` Daniel Jacobowitz
2003-12-01 17:52 ` Andrew Cagney
2003-12-01 18:10 ` Fred Fish
2003-12-09 1:02 ` Michael Snyder
2003-12-07 21:21 ` [PATCH] Outwit compiler dead code elimination in break.exp test (revised patch) Fred Fish
2003-12-08 0:31 ` Andrew Cagney
2003-12-01 16:55 [PATCH] Outwit compiler dead code elimination in break.exp test Michael Elizabeth Chastain
2003-12-08 23:49 [PATCH] Outwit compiler dead code elimination in break.exp test (revised patch) Andrew Cagney
2003-12-09 5:06 ` [PATCH] Outwit compiler dead code elimination in break.exp test Fred Fish
2003-12-09 6:52 Michael Elizabeth Chastain
2003-12-29 20:20 ` Elena Zannoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200311292305.hATN51Uj013311@fred.ninemoons.com \
--to=fnf@public.ninemoons.com \
--cc=fnf@ninemoons.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox