Bug 34889 - gcc.c-torture/execute/builtins/pr23484-chk.c fails on 16 bit integer platforms
Summary: gcc.c-torture/execute/builtins/pr23484-chk.c fails on 16 bit integer platforms
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: testsuite (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.2
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-20 19:38 UTC by Paulo Marques
Modified: 2008-06-04 01:57 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: avr-*-*
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments
the attached patch implements the proposed change (229 bytes, patch)
2008-01-20 19:39 UTC, Paulo Marques
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paulo Marques 2008-01-20 19:38:42 UTC
gcc.c-torture/execute/builtins/pr23484-chk.c has on line 44:

  if (snprintf (buf, l1 ? sizeof (buf) : 4, "%d", l1 + 65536) != 5
      || memcmp (buf, "655\0LLLL", 8))

but on a 16 bit platform like the avr, the "l1 + 65536" overflows and gives the wrong result. Changing that to:

  if (snprintf (buf, l1 ? sizeof (buf) : 4, "%d", l1 + 32760) != 5
      || memcmp (buf, "327\0LLLL", 8))

fixes the problem.
Comment 1 Paulo Marques 2008-01-20 19:39:30 UTC
Created attachment 14979 [details]
the attached patch implements the proposed change
Comment 2 Janis Johnson 2008-05-15 21:09:07 UTC
Paulo, please send the proposed patch to gcc-patches@gcc.gnu.org with an appropriate ChangeLog entry.
Comment 3 Andy Hutchinson 2008-05-20 23:57:11 UTC
Subject: Bug 34889

Author: hutchinsonandy
Date: Tue May 20 23:56:28 2008
New Revision: 135694

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135694
Log:
PR testsuite/34889
* gcc.c-torture/execute/builtins/pr23484-chk.c : Correct test for 16bit int target.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.c-torture/execute/builtins/pr23484-chk.c

Comment 4 Andy Hutchinson 2008-06-04 01:57:02 UTC
Fixed 4.4.
Needs backport to 4.3 sometime.