Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 39015
Product:  
Component:  
Status: RESOLVED
Resolution: INVALID
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Matthias Klose <doko@ubuntu.com>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
gsf-scan.c The (gtk-doc-tools generated) gsf-scan.c file which gets miscompiled text/x-csrc 2009-01-29 09:10 7.66 KB Edit
gsf-scan.i The (gtk-doc-tools generated) gsf-scan.c file which gets miscompiled, preprocessed. text/x-csrc 2009-01-29 09:11 87.39 KB Edit
libgsf-enum-register.patch libgsf-enum-register.patch patch 2009-01-30 11:39 310 bytes Edit | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 39015 depends on: Show dependency tree
Show dependency graph
Bug 39015 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2009-01-29 05:39
[forwarded from http://bugs.debian.org/513420]

Reverting the fix for PR38615 on the 4.3 branch lets the build succeed.

What am I trying to do:
* Build libgsf from source again on amd64 (or build libgsf svn trunk).

How am I trying to do it / steps to reproduce:
* Set up a sid environment in which to build libgsf from the Debian source
  package, e.g. in pbuilder.
* Get the libgsf source package and extract it.
* In the source directory, run
        env MALLOC_CHECK_=2 debian/rules build

What behaviour did I expect to get:
* The libgsf build runs to completion.

What behaviour did I actually get:
* The libgsf build fails during documentation generation, with messages
  similar to the following:
        creating gsf-scan
        gtk-doc: Running scanner gsf-scan
        sh: line 1: 27898 Segmentation fault      ( ./gsf-scan )
        Scan failed: 
        make[3]: *** [scan-build.stamp] Error 139
        make[3]: Leaving directory `/tmp/buildd/libgsf-1.14.11/build/doc'
* This behaviour is fully repeatable for me.

Notes and observations:
* "gsf-scan" is built from generated sources using gtk-doc-tools.
* To preserve the gsf-scan sources and objects, comment out the unlink line
  which removes them in /usr/bin/gtkdoc-scangobj .
* When running plain "debian/rules build" without the env MALLOC_CHECK_=2,
  the problem manifests at a later point in the build as follows:
        cd ../../doc/html && gtkdoc-mkhtml   gsf ../gsf-docs.sgml
        ../xml/text.xml:255: parser error : Input is not proper UTF-8, indicate
encoding !
        Bytes: 0xD0 0x45 0x2E 0x02
        <para>When to quote fields.</para><para>Default value: ŠE.</para>
                                                               ^
        ../xml/text.xml:255: parser error : PCDATA invalid Char value 2
        <para>When to quote fields.</para><para>Default value: ŠE.</para>
                                                                  ^
        ../xml/text.xml:279: parser error : chunk is not well balanced

        ^
        ../gsf-docs.sgml:232: parser error : Failure to process entity GsfText
            &GsfText;
                     ^
        ../gsf-docs.sgml:232: parser error : Entity 'GsfText' not defined
            &GsfText;
                     ^
        unable to parse ../gsf-docs.sgml
        make[3]: *** [html-build.stamp] Error 6
  This can be tracked back to a garbage string in the <DEFAULT> block within
  the <ARG> block for GsfOutputCsvQuotingMode in doc/gsf.args which is a
  file generated by gsf-scan. The garbage string can vary between repeated
  attempts.
* This libgsf version (1.14.11-1) has previously been built successfully on
  all architectures.
* The problem is still reproducible for me when the optimisation level is
  reduced (in debian/rules) to -O1 .
* I could not reproduce the problem in the following variations:
  * When lowering the optimisation level to -O0 .
  * Building in a 32-bit pbuilder chroot on amd64.
  * Building in a sid environment with the gcc-4.3 packages downgraded to
    the 4.3.2-1.1 versions from testing.
  * Building using CC=gcc-4.2 .
  * Building using CC=gcc-4.1 .
  * Building using CC=/usr/lib/gcc-snapshot/bin/gcc .
  which makes me suspect that the problem isn't with the (generated)
  gsf-scan sources, but with gcc's code generation.

------- Comment #1 From J.H.M. Dassen (Ray) 2009-01-29 09:10 -------
Created an attachment (id=17206) [edit]
The (gtk-doc-tools generated) gsf-scan.c file which gets miscompiled

------- Comment #2 From J.H.M. Dassen (Ray) 2009-01-29 09:11 -------
Created an attachment (id=17207) [edit]
The (gtk-doc-tools generated) gsf-scan.c file which gets miscompiled,
preprocessed.

------- Comment #3 From Richard Guenther 2009-01-29 10:01 -------
The best option would be to revert that patch on the branch.

------- Comment #4 From Matthias Klose 2009-01-29 10:14 -------
when Ray wrote he tested with a snapshot build, I assume this was 20090107
without the patch applied, so the status on the trunk is not known yet. will
test with current trunk later.

------- Comment #5 From J.H.M. Dassen (Ray) 2009-01-29 10:24 -------
(In reply to comment #4)
> when Ray wrote he tested with a snapshot build, I assume this was 20090107
> without the patch applied,

Yes, I was using sid's gcc-snapshot 20090107-1.

------- Comment #6 From Steve Ellcey 2009-01-29 17:00 -------
What GCC options was gsf-scan.i compiled with?  I am trying to see what
variables are getting/not getting promoted during the compilation and I am not
seeing it affect any variables if I just compile gsf-scan.i with -O[0123].

------- Comment #7 From J.H.M. Dassen (Ray) 2009-01-29 17:53 -------
(In reply to comment #3)
> The best option would be to revert that patch on the branch.

Matthias did that in the 4.3.3-3 packages and with them, the problem has
indeed gone away.

(In reply to comment #6)
> What GCC options was gsf-scan.i compiled with?

compile line: /bin/sh ../libtool --mode=compile cc -Wl,-z,defs -Wl,-O1
-Wl,--as-needed     -O2 -Wall -Wmissing-prototypes -Wnested-externs
-Wpointer-arith -Wno-sign-compare  -DG_DISABLE_DEPRECATED -Wno-system-headers
-Wfloat-equal -Wpointer-arith -Wbad-function-cast -Wwrite-strings
-Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -Wformat -Wnested-externs -Winline
-Wdeclaration-after-statement -Wundef -W -Wmissing-noreturn
-Wmissing-format-attribute -Wno-pointer-sign -DLIBGSF_GNOMEVFS_VIA_GIO -I../..
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2  
-O2 -Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith
-Wno-sign-compare  -DG_DISABLE_DEPRECATED -Wno-system-headers -Wfloat-equal
-Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wsign-compare
-Waggregate-return -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -Wformat -Wnested-externs -Winline
-Wdeclaration-after-statement -Wundef -W -Wmissing-noreturn
-Wmissing-format-attribute -Wno-pointer-sign -DLIBGSF_GNOMEVFS_VIA_GIO -c -o
gsf-scan.lo gsf-scan.c

link line: /bin/sh ../libtool --mode=link cc -Wl,-z,defs -Wl,-O1
-Wl,--as-needed  -O2 -Wall -Wmissing-prototypes -Wnested-externs
-Wpointer-arith -Wno-sign-compare  -DG_DISABLE_DEPRECATED -Wno-system-headers
-Wfloat-equal -Wpointer-arith -Wbad-function-cast -Wwrite-strings
-Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -Wformat -Wnested-externs -Winline
-Wdeclaration-after-statement -Wundef -W -Wmissing-noreturn
-Wmissing-format-attribute -Wno-pointer-sign -DLIBGSF_GNOMEVFS_VIA_GIO 
-no-undefined  -o gsf-scan gsf-scan.lo ../gsf/libgsf-1.la -lgobject-2.0
-lglib-2.0 -lxml2   -no-undefined 

------- Comment #8 From pinskia@gmail.com 2009-01-29 17:53 -------
Subject: Re:  [4.3 regression] wrong code building libgsf



Sent from my iPhone

On Jan 29, 2009, at 2:01 AM, "rguenth at gcc dot gnu dot org"
<gcc-bugzilla@gcc.gnu.org 
 > wrote:

>
>
> ------- Comment #3 from rguenth at gcc dot gnu dot org  2009-01-29  
> 10:01 -------
> The best option would be to revert that patch on the branch.

Except it alone could not cause wrong code.  Some other pass is  
causing it.  And then again with a testcase it is hard to figure out  
what is going wrong.  That patch just disables one small optimization  
in one case.

>
>
>
> -- 
>
> rguenth at gcc dot gnu dot org changed:
>
>           What    |Removed                     |Added
> --- 
> --- 
> ----------------------------------------------------------------------
>                 CC|                            |sje at gcc dot gnu  
> dot org,
>                   |                            |rguenth at gcc dot  
> gnu dot
>                   |                            |org
>           Priority|P3                          |P1
>   Target Milestone|---                         |4.3.4
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39015
>

------- Comment #9 From Steve Ellcey 2009-01-29 18:57 -------
So far I have been unable to reproduce this problem.  When compiling gsf-scan.i
I do not even reach the code that I changed in PR 38615 and I get the same code
with or without my change included.

Assuming there is a way to trigger this, I wonder if the program is legal.  In
particular I was looking at the initialization of GbArgTable which has a lot of
holes in it.  If the optimization affects whether or not these holes get set to
zero and if the program is accessing these uninitialized locations that could
cause a change in behaviour.

------- Comment #10 From Matthias Klose 2009-01-29 22:36 -------
I'm able to reproduce it with trunk 20090129. The gsf-scan executable links
against the just built libgsf.so, so I assume we have to look for a miscompiled
file in libgsf.

------- Comment #11 From Andrew Pinski 2009-01-29 22:39 -------
I don't see anything in gsf-scan.c which would have been changed by that patch.
 All the arrays are already marked as static.  The only ones that changed by
that patch are auto arrays.

------- Comment #12 From Andrew Pinski 2009-01-29 22:41 -------
(In reply to comment #9)
> Assuming there is a way to trigger this, I wonder if the program is legal.  In
> particular I was looking at the initialization of GbArgTable which has a lot of
> holes in it. 

Those holes are all zero but the array GbArgTable is already declared as static
so there will be no difference between before and after the patch.

------- Comment #13 From Jakub Jelinek 2009-01-30 10:58 -------
Nothing changed in gsf-scan.c, but out of the 3 objects in libgsf.so that
changed it seems to be gsf-output-csv.c where r143570 makes difference for
gsf-scan.  Looking at it now...

------- Comment #14 From Jakub Jelinek 2009-01-30 11:38 -------
And clearly the bug is in libgsf, not in gcc.
g_enum_register_static documentation says:
GObject keeps a reference to the data, so it cannot be stack-allocated.
so this relies on this optimization.  gsf_output_csv_quoting_mode_get_type
just needs to be fixed.

------- Comment #15 From Jakub Jelinek 2009-01-30 11:39 -------
Created an attachment (id=17213) [edit]
libgsf-enum-register.patch

Patch that fixes this.

------- Comment #16 From Jakub Jelinek 2009-01-30 11:40 -------
Invalid.

------- Comment #17 From J.H.M. Dassen (Ray) 2009-01-30 17:02 -------
Now fixed in libgsf upstream:
        http://svn.gnome.org/viewvc/libgsf?view=revision&revision=1039

Thank you very much!

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug