Bug 43604 - -fsyntax-only crashes on code that divides 64-bit integers
Summary: -fsyntax-only crashes on code that divides 64-bit integers
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 7.1
Hardware: i386 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-06-05 19:47 UTC by Trevin Beattie
Modified: 2007-04-18 16:33 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-06-05 21:32:54 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Trevin Beattie 2001-06-05 19:47:16 UTC
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:

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

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 21:32:47 UTC
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.