Обсуждение: Bug: x86_64-w64-mingw32 REL_11_STABLE with features:UpdateStatisticsForTypeChange internal compiler error

Поиск
Список
Период
Сортировка

Bug: x86_64-w64-mingw32 REL_11_STABLE with features:UpdateStatisticsForTypeChange internal compiler error

От
Andre Mikulec
Дата:

Hi,

When trying compile PostgreSQL REL_11_STABLE using x86_64-w64-mingw32 using

/w/R-3.5._/postgres/configure --host=x86_64-w64-mingw32 --prefix=$PWD/build CFLAGS="-O -fno-omit-frame-pointer" --disable-rpath --enable-depend --enable-cassert --enable-debug  --with-icu ICU_CFLAGS="-I/w/icu-61.1/icu4c/dist/include" ICU_LIBS="-L/w/icu-61.1/icu4c/dist/lib -licui18n -licuuc -licudata" --with-openssl --with-libxml --with-libxslt --with-tcl --with-python --with-perl --with-includes=/w/zlib-1.2.8-win32-x86_64/include:/w/openssl-1.0.2e-win32-x86_64/include:/w/libxml2-2.9.3-win32-x86_64/include/libxml2:/w/libxslt-1.1.28-win32-x86_64/include --with-libraries=/w/zlib-1.2.8-win32-x86_64/lib:/w/openssl-1.0.2e-win32-x86_64/lib:/w/libxml2-2.9.3-win32-x86_64/lib:/w/libxslt-1.1.28-win32-x86_64/lib

I am getting this error:

"
W:/R-3.5._/postgres/src/backend/commands/statscmds.c: In function 'UpdateStatisticsForTypeChange':
W:/R-3.5._/postgres/src/backend/commands/statscmds.c:435:1: internal compiler error: in based_loc_descr, at dwarf2out.c:14272
 }
 ^
"

Note: I can build without any errors using just

/w/R-3.5._/postgres/configure --host=x86_64-w64-mingw32 --prefix=$PWD/build --disable-rpath --enable-depend --enable-debug

I examined "W:/R-3.5._/postgres/src/backend/commands/statscmds.c" at line 41.
The only thing I can think of is that maybe the code should include a "return void;"?

The following is my method and results.

AnonymousUser@ANONYMOUST MINGW64 /w/R-3.5._/postgres/build
/w/R-3.5._/postgres/configure --host=x86_64-w64-mingw32 --prefix=$PWD/build CFLAGS="-O -fno-omit-frame-pointer" --disable-rpath --enable-depend --enable-cassert --enable-debug  --with-icu ICU_CFLAGS="-I/w/icu-61.1/icu4c/dist/include" ICU_LIBS="-L/w/icu-61.1/icu4c/dist/lib -licui18n -licuuc -licudata" --with-openssl --with-libxml --with-libxslt --with-tcl --with-python --with-perl --with-includes=/w/zlib-1.2.8-win32-x86_64/include:/w/openssl-1.0.2e-win32-x86_64/include:/w/libxml2-2.9.3-win32-x86_64/include/libxml2:/w/libxslt-1.1.28-win32-x86_64/include --with-libraries=/w/zlib-1.2.8-win32-x86_64/lib:/w/openssl-1.0.2e-win32-x86_64/lib:/w/libxml2-2.9.3-win32-x86_64/lib:/w/libxslt-1.1.28-win32-x86_64/lib

AnonymousUser@ANONYMOUST MINGW64 /w/R-3.5._/postgres/build
make --debug

   File 'statscmds.o' does not exist.
  Must remake target 'statscmds.o'.
x86_64-w64-mingw32-gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O -fno-omit-frame-pointer -I../../../src/include -I/w/R-3.5._/postgres/src/include -I/w/icu-61.1/icu4c/dist/include -I/w/R-3.5._/postgres/src/include/port/win32 -DEXEC_BACKEND  -I/w/zlib-1.2.8-win32-x86_64/include -I/w/openssl-1.0.2e-win32-x86_64/include -I/w/libxml2-2.9.3-win32-x86_64/include/libxml2 -I/w/libxslt-1.1.28-win32-x86_64/include "-I/w/R-3.5._/postgres/src/include/port/win32" -DBUILDING_DLL  -c -o statscmds.o /w/R-3.5._/postgres/src/backend/commands/statscmds.c -MMD -MP -MF .deps/statscmds.Po
during RTL pass: final
W:/R-3.5._/postgres/src/backend/commands/statscmds.c: In function 'UpdateStatisticsForTypeChange':
W:/R-3.5._/postgres/src/backend/commands/statscmds.c:435:1: internal compiler error: in based_loc_descr, at dwarf2out.c:14272
 }
 ^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://sourceforge.net/projects/msys2> for instructions.
make[3]: *** [../../../src/Makefile.global:878: statscmds.o] Error 1
make[3]: Leaving directory '/w/R-3.5._/postgres/build/src/backend/commands'
make[2]: *** [/w/R-3.5._/postgres/src/backend/common.mk:39: commands-recursive] Error 2
make[2]: Leaving directory '/w/R-3.5._/postgres/build/src/backend'
make[1]: *** [Makefile:42: all-backend-recurse] Error 2
make[1]: Leaving directory '/w/R-3.5._/postgres/build/src'
make: *** [GNUmakefile:11: all-src-recurse] Error 2

I tried manually. . . .

AnonymousUser@ANONYMOUST MINGW64 /w/R-3.5._/postgres/build
$ make -C src/backend/commands
retuns the same

I examined.
AnonymousUser@ANONYMOUST MINGW64 /w/R-3.5._/postgres/build
$ view /w/R-3.5._/postgres/src/backend/commands/statscmds.c

Attached are my config.log and config.status.

From the postgresql mirror https://github.com/postgres/postgres
I am using this commit.
(This is probably no longer the head)
***
AnonymousUser@ANONYMOUST MINGW64 /w/R-3.5._/postgres (REL_11_STABLE)
$ git log
commit bd47c4a9d4ec55e26e841754ce62c23ca9008e87 (HEAD -> REL_11_STABLE, origin/REL_11_STABLE)
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date:   Mon Sep 3 12:58:42 2018 -0300
***

Thanks,
Andre Mikulec
Andre_Mikulec@Hotmail.com


Virus-free. www.avg.com
Вложения
Andre Mikulec <andre_mikulec@hotmail.com> writes:
> When trying compile PostgreSQL REL_11_STABLE using x86_64-w64-mingw32 using
> I am getting this error:
> W:/R-3.5._/postgres/src/backend/commands/statscmds.c: In function 'UpdateStatisticsForTypeChange':
> W:/R-3.5._/postgres/src/backend/commands/statscmds.c:435:1: internal compiler error: in based_loc_descr, at
dwarf2out.c:14272

This is a compiler bug, you should be submitting it to the gcc people.

            regards, tom lane


It is an up-to-date compiler.

AnonymousUser@ANONYMOUST MINGW64 /w/R-3.5._/postgres/build
$  x86_64-w64-mingw32-gcc --version
x86_64-w64-mingw32-gcc.exe (Rev1, Built by MSYS2 project) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

These people here do not think that "a missing return statement" is a good
idea.

Why and how does GCC compile a function with a missing return statement?
https://stackoverflow.com/questions/7280877/why-and-how-does-gcc-compile-a-function-with-a-missing-return-statement

"
The subtraction of 32 was carried out in the %eax register. 
And in the x86 calling convention, that is the register in which 
the return value is expected to be! So... you got lucky.
"

Of
$ view /w/R-3.5._/postgres/src/backend/commands/statscmds.c

Here is the function.

419 void
420 UpdateStatisticsForTypeChange(Oid statsOid, Oid relationOid, int attnum,
421                                                           Oid
oldColumnType, Oid newColumnType)
422 {
423         /*
424          * Currently, we don't actually need to do anything here.  For
both
425          * ndistinct and functional-dependencies stats, the on-disk
representation
426          * is independent of the source column data types, and it is
plausible to
427          * assume that the old statistic values will still be good for
the new
428          * column contents.  (Obviously, if the ALTER COLUMN TYPE has a
USING
429          * expression that substantially alters the semantic meaning of
the column
430          * values, this assumption could fail.  But that seems like a
corner case
431          * that doesn't justify zapping the stats in common cases.)
432          *
433          * Future types of extended stats will likely require us to work
harder.
434          */
435 }  <---------- **  The error is here at line 435 and position 1. ** 






--
Sent from: http://www.postgresql-archive.org/PostgreSQL-bugs-f2117394.html


>>>>> "Andre" == Andre Mikulec <Andre_Mikulec@Hotmail.com> writes:

 Andre> It is an up-to-date compiler.

That doesn't mean it lacks bugs!

It's even TELLING YOU that it's an "internal compiler error". That means
the error is in the compiler, not in the code being compiled.

 Andre> These people here do not think that "a missing return statement"
 Andre> is a good idea.

In a function that returns void, a missing return statement is
absolutely legal.

The SO question you linked to is irrelevant because that's talking about
a function that returns a value (not void).

-- 
Andrew (irc:RhodiumToad)


Andre_Mikulec <Andre_Mikulec@Hotmail.com> writes:
> It is an up-to-date compiler.

Doesn't mean it has no bugs.  It is in fact *telling you* it has a bug.

> These people here do not think that "a missing return statement" is a good
> idea.

If they can convince the C standards committee, then I'll worry about
their opinion.  Functions returning void are not required to have return
statements per the standard.

Moreover, I'm pretty sure this is not the only function in PG with an
empty body.  I think the fact that the compiler is crashing right there
is likely not related to the empty function as such, but has a lot to do
with what else it has processed in the same compilation.

            regards, tom lane


How would I 'go about' isolating this problem?

I rerun like this.

AnonymousUser@ANONYMOUST MINGW64 /w/R-3.5._/postgres/build
$ make -C src/backend/commands

x86_64-w64-mingw32-gcc -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard
-Wno-format-truncation -Wno-stringop-truncation -g -O
-fno-omit-frame-pointer -I../../../src/include
-I/w/R-3.5._/postgres/src/include -I/w/icu-61.1/icu4c/dist/include
-I/w/R-3.5._/postgres/src/include/port/win32 -DEXEC_BACKEND 
-I/w/zlib-1.2.8-win32-x86_64/include
-I/w/openssl-1.0.2e-win32-x86_64/include
-I/w/libxml2-2.9.3-win32-x86_64/include/libxml2
-I/w/libxslt-1.1.28-win32-x86_64/include
"-I/w/R-3.5._/postgres/src/include/port/win32" -DBUILDING_DLL  -c -o
statscmds.o /w/R-3.5._/postgres/src/backend/commands/statscmds.c -MMD -MP
-MF .deps/statscmds.Po
during RTL pass: final
W:/R-3.5._/postgres/src/backend/commands/statscmds.c: In function
'UpdateStatisticsForTypeChange':
W:/R-3.5._/postgres/src/backend/commands/statscmds.c:435:1: internal
compiler error: in based_loc_descr, at dwarf2out.c:14272
 }
 ^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://sourceforge.net/projects/msys2> for instructions.
make: *** [../../../src/Makefile.global:878: statscmds.o] Error 1
make: Leaving directory '/w/R-3.5._/postgres/build/src/backend/commands'

Below, I try to create something reproducible using the same gcc arguments.

AnonymousUser@ANONYMOUST MINGW64 /w/R-3.5._/postgres/build
$ cat example.c


void myfunct(int something);

void myfunct (int something)
{
  /* comment */
}
int main() {
  myfunct(0);
}

I compile without a problem (below).

AnonymousUser@ANONYMOUST MINGW64 /w/R-3.5._/postgres/build
$ x86_64-w64-mingw32-gcc -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wmissing-forma-attribute
-Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard
-Wno-format-truncation -Wno-stringop-trunction -g -O -fno-omit-frame-pointer
example.c -save-temps

When I try to extract from what I have in my shell and replace commands.c
with example.c, then I get the following error.
I get the response (below)
"
fatal error: opening dependency file .deps/statscmds.Po: No such file or
directory
"

AnonymousUser@ANONYMOUST MINGW64 /w/R-3.5._/postgres/build
$ x86_64-w64-mingw32-gcc -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard
-Wno-format-truncation -Wno-stringop-truncation -g -O
-fno-omit-frame-pointer example.c -MMD -MP -MF .deps/statscmds.Po
-save-temps
example.c:1: fatal error: opening dependency file .deps/statscmds.Po: No
such file or directory

compilation terminated.

I try to break down the problem in example2.c ( below )

-- begin example2.c --

#include "postgres.h"

#include "access/relscan.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_statistic_ext.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "miscadmin.h"
#include "statistics/statistics.h"
#include "utils/builtins.h"
#include "utils/inval.h"
#include "utils/memutils.h"
#include "utils/rel.h"
#include "utils/syscache.h"
#include "utils/typcache.h"

/* defrem.h */
extern void UpdateStatisticsForTypeChange(Oid statsOid,
                              Oid relationOid, int attnum,
                              Oid oldColumnType, Oid newColumnType);

void
UpdateStatisticsForTypeChange(Oid statsOid, Oid relationOid, int attnum,
                                                          Oid oldColumnType,
Oid newColumnType)
{
        /*
         * Currently, we don't actually need to do anything here.  For both
         * ndistinct and functional-dependencies stats, the on-disk
representation
         * is independent of the source column data types, and it is
plausible to
         * assume that the old statistic values will still be good for the
new
         * column contents.  (Obviously, if the ALTER COLUMN TYPE has a
USING
         * expression that substantially alters the semantic meaning of the
column
         * values, this assumption could fail.  But that seems like a corner
case
         * that doesn't justify zapping the stats in common cases.)
         *
         * Future types of extended stats will likely require us to work
harder.
         */
}

-- end example2.c --

But when I try again. ( note: -save-temps is a requirement to submit a 'gcc'
bug )

AnonymousUser@ANONYMOUST MINGW64 /w/R-3.5._/postgres/build
$ x86_64-w64-mingw32-gcc -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard
-Wno-format-truncation -Wno-stringop-truncation -g -O
-fno-omit-frame-pointer -I../../../src/include
-I/w/R-3.5._/postgres/src/include -I/w/icu-61.1/icu4c/dist/include
-I/w/R-3.5._/postgres/src/include/port/win32 -DEXEC_BACKEND 
-I/w/zlib-1.2.8-win32-x86_64/include
-I/w/openssl-1.0.2e-win32-x86_64/include
-I/w/libxml2-2.9.3-win32-x86_64/include/libxml2
-I/w/libxslt-1.1.28-win32-x86_64/include
"-I/w/R-3.5._/postgres/src/include/port/win32" -DBUILDING_DLL  -c -o
example2.o example2.c -MMD -MP -MF .deps/statscmds.Po -save-temps


Below, I get this error

In file included from W:/R-3.5._/postgres/src/include/c.h:49,
                 from W:/R-3.5._/postgres/src/include/postgres.h:46,
                 from example2.c:2:
W:/R-3.5._/postgres/src/include/postgres_ext.h:26:10: fatal error:
pg_config_ext.h: No such file or directory
 #include "pg_config_ext.h"
          ^~~~~~~~~~~~~~~~~
compilation terminated.

What is a good next step?

Please help. 
Thanks.
Andre Mikulec







--
Sent from: http://www.postgresql-archive.org/PostgreSQL-bugs-f2117394.html


Andre_Mikulec <Andre_Mikulec@Hotmail.com> writes:
> Below, I get this error

> In file included from W:/R-3.5._/postgres/src/include/c.h:49,
>                  from W:/R-3.5._/postgres/src/include/postgres.h:46,
>                  from example2.c:2:
> W:/R-3.5._/postgres/src/include/postgres_ext.h:26:10: fatal error:
> pg_config_ext.h: No such file or directory
>  #include "pg_config_ext.h"
>           ^~~~~~~~~~~~~~~~~
> compilation terminated.

It looks like you didn't run configure (or do whatever the Windows
port does to set up the pg_config*.h files).

            regards, tom lane


I had ran 'configure' like I showed at the top of this bug report.

The file is there.

AnonymousUser@ANONYMOUST MINGW64 /w/R-3.5._/postgres/build
$ ls -alrt W:/R-3.5._/postgres/src/include/postgres_ext.h
-rw-r--r-- 1 AnonymousUser None 2313 Sep  2 21:07
W:/R-3.5._/postgres/src/include/postgres_ext.h

Any idea of a 'direction to go' would be most appreciated.

Thanks,
Andre Mikulec
Andre_Mikulec@Hotmail.com





--
Sent from: http://www.postgresql-archive.org/PostgreSQL-bugs-f2117394.html