1/* Copyright 2002, 2003, 2004, 2007, 2008, 2009, 2010, 2011 2Free Software Foundation, Inc. 3 4 This file is part of GDB. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 19/* Test taken from GCC. Verify that we can print a structure containing 20 a complex number. */ 21 22#include <stdlib.h> 23 24typedef __complex__ float cf; 25struct x { char c; cf f; } __attribute__ ((__packed__)); 26struct unpacked_x { char c; cf f; }; 27extern void f4 (struct unpacked_x*); 28extern void f3 (void); 29extern void f2 (struct x*); 30extern void f1 (void); 31int 32main (void) 33{ 34 f1 (); 35 f3 (); 36 exit (0); 37} 38 39void 40f1 (void) 41{ 42 struct x s; 43 s.f = 1; 44 s.c = 42; 45 f2 (&s); 46} 47 48void 49f2 (struct x *y) 50{ 51 if (y->f != 1 || y->c != 42) 52 abort (); 53} 54 55void 56f3 (void) 57{ 58 struct unpacked_x s; 59 s.f = 1; 60 s.c = 42; 61 f4 (&s); 62} 63 64void 65f4 (struct unpacked_x *y) 66{ 67 if (y->f != 1 || y->c != 42) 68 abort (); 69} 70