Bug 57546 - Sources won't compile with more strict compiler
Sources won't compile with more strict compiler
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: ghostscript (Show other bugs)
7.2
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-12-15 06:05 EST by Sysoltsev Slawa
Modified: 2007-04-18 12:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-01-10 12:18:44 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch for ghostscript sources for compilers which doesn't support complicated variable length arrays (453 bytes, patch)
2001-12-15 06:09 EST, Sysoltsev Slawa
no flags Details | Diff
I correct errors arised and now ghostscript build succesfully. I attach this patch (previous one about vla is already attached) to ease your work for make Red Hat Linux more portable. (1.16 KB, patch)
2001-12-18 04:50 EST, Sysoltsev Slawa
no flags Details | Diff

  None (edit)
Description Sysoltsev Slawa 2001-12-15 06:05:57 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

Description of problem:
Let we look into ghostscript-6.51 sources.
File "ghostscript-6.51/src/eplaser/gdevesmv.c", function "private int
esmv_fill_mask".
There are two local variables (line 1508, 1509):
    gx_device_vector const      *vdev = (gx_device_vector *) dev;
    gx_device_esmv const        *pdev = (gx_device_esmv *) dev;
As there is written this is the pointers to const struct. But we can see 
in subsequent lines:
(line 1531) pdev->current_color = color;
(line 1547) pdev->MaskState = 1;

There is modifying of constant value (gcc allows it in plain C) and gcc 
emits warning on it:
./src/gdevesmv.c:1531: warning: assignment of read-only member 
`current_color'
More strict compiler (in example Intel Proton compiler) would produce 
error on this, so you should remove 'const' qualifier on these variables 
in order to increase Red Hat Linux portability.

P.S.: maybe author wanted to declare const pointer to structures - it can 
be made so:
gx_device_vector * const      vdev = (gx_device_vector *) dev;
and there will be no error or warning emitted.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
If you haven't Intel compiler (icc) you will not be able to reproduce this 
error.

If you have Intel compiler:
1. Make sure, that Intel compiler will be called instead of gcc, g++ and 
so anyway.
2. Install ghostscript-6.51-12.src.rpm. (-i option for rpm).
3. icc doesn't support complicated vla's - i make 
patch 'src_vla.patch'(attached) which helps you avoid possible errors 
concerned with this.
4. Try to build ghostscript.spec (-bc option for rpm) and get an error 
message.

Actual Results:  Error message will be emitted:
"./src/gdevesmv.c", line 1531: error: expression must be a modifiable 
lvalue
      pdev->current_color = color;
      ^


Expected Results:  Succesfully builded ghostscript package.

Additional info:
Comment 1 Sysoltsev Slawa 2001-12-15 06:09:23 EST
Created attachment 40730 [details]
Patch for ghostscript sources for compilers which doesn't support complicated variable length arrays
Comment 2 Sysoltsev Slawa 2001-12-18 04:50:00 EST
Created attachment 40887 [details]
I correct errors arised and now ghostscript build succesfully. I attach this patch (previous one about vla is already attached) to ease your work for make Red Hat Linux more portable.
Comment 3 Tim Waugh 2002-01-10 12:18:38 EST
Thanks for the patch.
Comment 4 Tim Waugh 2002-02-11 11:06:32 EST
Filed upstream (sf #515966).  I'd rather wait until this filters through via an
upstream release, since this is for non-GCC builds only (and we build our
packages with GCC).

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