Re: [BUGS] BUG #14897: Segfault on statitics SQL request

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Dmitry Dolgov <9erthalion6@gmail.com>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, Vincent Lachenal <vincent.lachenal@gmail.com>, PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Date: 2017-11-14T06:22:04Z
Lists: pgsql-bugs
On 2017-11-14 15:16:34 +0900, Michael Paquier wrote:
> Oh, well. I am not sure what went wrong. But I can see the difference
> now, which is what you have:
> @@ -2652,7 +2652,7 @@ numericvar_to_int128:
>      pxor    %xmm0, %xmm0
>      movl    $1, %ebx
>      testq    %rdi, %rdi
> -    movups    %xmm0, (%r14)
> +    movaps    %xmm0, (%r14)
>      je    .L452
>      call    pfree@PLT
>  .L452:
> @@ -13856,10 +13856,10 @@ numeric_poly_combine:
>      movq    8(%rbp), %rdx
>      movq    %r12, CurrentMemoryContext(%rip)
>      movq    %rdx, 8(%rax)
> -    movdqu    16(%rbp), %xmm0
> -    movups    %xmm0, 16(%rax)
> -    movdqu    32(%rbp), %xmm0
> -    movups    %xmm0, 32(%rax)
> +    movdqa    16(%rbp), %xmm0
> +    movaps    %xmm0, 16(%rax)
> +    movdqa    32(%rbp), %xmm0
> +    movaps    %xmm0, 32(%rax)
>      jmp    .L2110
>  .L2124:
>      leaq    .LC0(%rip), %rdi
> @@ -14338,8 +14338,8 @@ int8_avg_combine:
>      movq    8(%rbp), %rdx
>      movq    %r12, CurrentMemoryContext(%rip)
>      movq    %rdx, 8(%rax)
> -    movdqu    16(%rbp), %xmm0
> -    movups    %xmm0, 16(%rax)
> +    movdqa    16(%rbp), %xmm0
> +    movaps    %xmm0, 16(%rax)

Just to be sure: This is the diff you're getting when you *back out* the
fix, right? Because movdqa etc are the alignment requiring instructions,
whereas movdqu is unaligned...

Greetings,

Andres Freund


Commits

  1. Prevent int128 from requiring more than MAXALIGN alignment.

  2. Rearrange c.h to create a "compiler characteristics" section.