xref: /netbsd-src/external/gpl3/gcc.old/dist/libbacktrace/edtest2.c (revision 4c3eb207d36f67d31994830c0a694161fc1ca39b)
1cef8759bSmrg /* edtest2.c -- Test for libbacktrace storage allocation stress handling (p2)
2*4c3eb207Smrg    Copyright (C) 2017-2020 Free Software Foundation, Inc.
3cef8759bSmrg 
4cef8759bSmrg Redistribution and use in source and binary forms, with or without
5cef8759bSmrg modification, are permitted provided that the following conditions are
6cef8759bSmrg met:
7cef8759bSmrg 
8cef8759bSmrg     (1) Redistributions of source code must retain the above copyright
9cef8759bSmrg     notice, this list of conditions and the following disclaimer.
10cef8759bSmrg 
11cef8759bSmrg     (2) Redistributions in binary form must reproduce the above copyright
12cef8759bSmrg     notice, this list of conditions and the following disclaimer in
13cef8759bSmrg     the documentation and/or other materials provided with the
14cef8759bSmrg     distribution.
15cef8759bSmrg 
16cef8759bSmrg     (3) The name of the author may not be used to
17cef8759bSmrg     endorse or promote products derived from this software without
18cef8759bSmrg     specific prior written permission.
19cef8759bSmrg 
20cef8759bSmrg THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21cef8759bSmrg IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22cef8759bSmrg WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23cef8759bSmrg DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
24cef8759bSmrg INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25cef8759bSmrg (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26cef8759bSmrg SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27cef8759bSmrg HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28cef8759bSmrg STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29cef8759bSmrg IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30cef8759bSmrg POSSIBILITY OF SUCH DAMAGE.  */
31cef8759bSmrg 
32cef8759bSmrg /* This file intentionally written without any #include's
33cef8759bSmrg  */
34cef8759bSmrg 
35cef8759bSmrg extern int f3(int, int);
36cef8759bSmrg extern int f2(int);
37cef8759bSmrg 
f2(int x)38cef8759bSmrg int f2(int x)
39cef8759bSmrg {
40cef8759bSmrg   /* Returning a value here and elsewhere avoids a tailcall which
41cef8759bSmrg      would mess up the backtrace.  */
42cef8759bSmrg   return f3(x, __LINE__) + 3;
43cef8759bSmrg }
44