Bug 43604 - -fsyntax-only crashes on code that divides 64-bit integers
-fsyntax-only crashes on code that divides 64-bit integers
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-06-05 15:47 EDT by Trevin Beattie
Modified: 2007-04-18 12:33 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-06-05 17:32:54 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Trevin Beattie 2001-06-05 15:47:16 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.2-2 i586)

Description of problem:
I have a function that divides a 64-bit integer for conversion to an ASCII
string in some arbitrary base.  When I try to check the code for syntax
errors using -fsyntax-only, the compiler bombs out at divstub.c:8.


How reproducible:
Always

Steps to Reproduce:
1. Copy the following to a file, such as "divstub.c":

int
foo (char *s, unsigned long long n)
{
  long long p;
  int i;

  p = 1LL;
  while (n / p >= 10)
    p = p * 10;

  for (i = 0; p; p = p / 10, i++)
    {
      s[i] = (n / p) + '0';
      n = n % p;
    }

  return i;
}

2. Run "gcc -fsyntax-only divstub.c".


Actual Results:  divstub.c: In function `foo':
divstub.c:8: Internal error: Segmentation fault.
Please submit a full bug report.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.


Expected Results:  The same code, with "long long" replaced by "long" (and
LL replaced by L), results in no output from the compiler.


Additional info:

The -c and -S options to the compiler still work with this sample code, and
offhand I don't see anything amiss in the .s file.
Comment 1 Jakub Jelinek 2001-06-05 17:32:47 EDT
Fixed by http://gcc.gnu.org/ml/gcc-patches/2000-08/msg00739.html
which I've just backported. It will appear in gcc-2.96-86.

Note You need to log in before you can comment on or make changes to this bug.