From nobody@FreeBSD.org  Fri Jan  3 01:41:52 2014
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id 0D197235
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  3 Jan 2014 01:41:52 +0000 (UTC)
Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id EBE501846
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  3 Jan 2014 01:41:51 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id s031fpvX044353
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 3 Jan 2014 01:41:51 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id s031fp59044345;
	Fri, 3 Jan 2014 01:41:51 GMT
	(envelope-from nobody)
Message-Id: <201401030141.s031fp59044345@oldred.freebsd.org>
Date: Fri, 3 Jan 2014 01:41:51 GMT
From: Stephen Hurd <shurd@sasktel.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: gcc bug with short int promotion
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         185431
>Category:       gnu
>Synopsis:       gcc(1) bug with short int promotion
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 03 01:50:00 UTC 2014
>Closed-Date:    
>Last-Modified:  Sun May 04 05:05:22 UTC 2014
>Originator:     Stephen Hurd
>Release:        9.1-RELEASE-p6
>Organization:
>Environment:
FreeBSD cracked.hurd.local 9.1-RELEASE-p6 FreeBSD 9.1-RELEASE-p6 #0: Wed Aug 21 20:30:17 UTC 2013     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
Integer promotion of a short int and an unsigned short in the same
expression seems broken in the system compiler.
>How-To-Repeat:
#include <stdio.h>

int main(int argc, char **argv)
{
        short k = 251;
        unsigned short l = 65535;

        printf("%hd > %hu = %d\n", k, l, (k > l));
        return 0;
}

> gcc test.c
> ./a.out
251 > 65535 = 1
>Fix:
Use a different compiler.

>Release-Note:
>Audit-Trail:
>Unformatted:
