This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c/4939: [cygwin] Failure of test gcc.dg/c99-intconst-1.c

[Get raw message]

>Number:         4939
>Category:       c
>Synopsis:       [cygwin] Failure of test gcc.dg/c99-intconst-1.c
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 23 21:36:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     David Billinghurst
>Release:        gcc-3.1
>Organization:
>Environment:
i686-pc-cygwin
>Description:
New test gcc.dg/c99-inconst-1.c fails on cygwin.  Part of the problem is missing definitions in limits.h.  With these fixed, the test still fails with repeated warnings on lines 237 and 238:

/usr/local/src/gcc/gcc/testsuite/gcc.dg/c99-intconst-1.c:237: warning: decimal constant is so large that it is unsigned

/usr/local/src/gcc/gcc/testsuite/gcc.dg/c99-intconst-1.c:237: assignment from incompatible pointer type

A reduced test case that gives the same error is

/* Origin: Joseph Myers <jsm28@cam.ac.uk>.  */
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */

#include <limits.h>

/* Assertion that constant C is of type T.  */
#define ASSERT_CONST_TYPE(C, T)			\
	do {					\
	  typedef T type;			\
	  typedef type **typepp;		\
	  typedef __typeof__((C)) ctype;	\
	  typedef ctype **ctypepp;		\
	  typepp x = 0;				\
	  ctypepp y = 0;			\
	  x = y;				\
	  y = x;				\
	} while (0)

/* (T *) if E is zero, (void *) otherwise.  */
#define type_if_not(T, E) __typeof__(0 ? (T *)0 : (void *)(E))

/* (T *) if E is nonzero, (void *) otherwise.  */
#define type_if(T, E) type_if_not(T, !(E))

/* Combine pointer types, all but one (void *).  */
#define type_comb2(T1, T2) __typeof__(0 ? (T1)0 : (T2)0)
#define type_comb3(T1, T2, T3) type_comb2(T1, type_comb2(T2, T3))

/* (T1 *) if E1, otherwise (T2 *) if E2, otherwise (T3 *) if E3.  */
#define first_of3p(T1, E1, T2, E2, T3, E3)			\
	type_comb3(type_if(T1, (E1)),				\
		   type_if(T2, (!(E1) && (E2))),		\
		   type_if(T3, (!(E1) && !(E2) && (E3))))

#define first_of3(T1, E1, T2, E2, T3, E3)				\
	__typeof__(*((first_of3p(T1, (E1), T2, (E2), T3, (E3)))0))

/* Types of constants according to the C99 rules.  */
#define C99_UNSUF_DEC_TYPE(C)				\
	first_of3(int, (C) <= INT_MAX,			\
		  long int, (C) <= LONG_MAX,		\
		  long long int, (C) <= LLONG_MAX)

/* Checks that constants have correct type.  */
#define CHECK_UNSUF_DEC_TYPE(C) ASSERT_CONST_TYPE((C), C99_UNSUF_DEC_TYPE((C)))

void
foo (void)
{
  CHECK_UNSUF_DEC_TYPE(2147483648);
}


The preprocessed source from this is attached:


>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="l.i"
Content-Disposition: inline; filename="l.i"

# 1 "l.c"
# 1 "<builtin>"
# 1 "<command line>"
# 1 "l.c"






# 1 "/usr/local/obj/gcc/gcc/include/limits.h" 1 3
# 11 "/usr/local/obj/gcc/gcc/include/limits.h" 3
# 1 "/usr/local/obj/gcc/gcc/include/syslimits.h" 1 3






# 1 "/usr/local/obj/gcc/gcc/include/limits.h" 1 3
# 132 "/usr/local/obj/gcc/gcc/include/limits.h" 3
# 1 "/usr/local/lib/gcc-lib/i686-pc-cygwin/3.1/include/limits.h" 1 3
# 132 "/usr/local/lib/gcc-lib/i686-pc-cygwin/3.1/include/limits.h" 3
# 1 "/usr/include/limits.h" 1 3
# 133 "/usr/local/lib/gcc-lib/i686-pc-cygwin/3.1/include/limits.h" 2 3
# 133 "/usr/local/obj/gcc/gcc/include/limits.h" 2 3
# 8 "/usr/local/obj/gcc/gcc/include/syslimits.h" 2 3
# 12 "/usr/local/obj/gcc/gcc/include/limits.h" 2 3
# 8 "l.c" 2
# 50 "l.c"
void
foo (void)
{
  int int_max = 2147483647;
  do { typedef __typeof__(*((__typeof__(0 ? (__typeof__(0 ? (int *)0 : (void *)(!(((((2147483648)) <= 2147483647))))))0 : (__typeof__(0 ? (__typeof__(0 ? (long int *)0 : (void *)(!((!((((2147483648)) <= 2147483647)) && ((((2147483648)) <= 2147483647L)))))))0 : (__typeof__(0 ? (long long int *)0 : (void *)(!((!((((2147483648)) <= 2147483647)) && !((((2147483648)) <= 2147483647L)) && ((((2147483648)) <= 9223372036854775807LL)))))))0))0))0)) type; typedef type **typepp; typedef __typeof__(((2147483648))) ctype; typedef ctype **ctypepp; typepp x = 0; ctypepp y = 0; x = y; y = x; } while (0);
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]