Skip to content

Segfault on arm32 with small precision in arb #2521

@bobot

Description

@bobot

Describe the bug
A seemingly correct use of the API results in a segfault on arm32

Steps to reproduce
The following program segfault on arm32 (flint 3.1.3, 3.4.0-1) tested on debian, in the function _qqbar_validate_existence_uniqueness

Changing prec to 2 avoid the problem.

test.c :

#include <stdio.h>
#include <flint/fmpz_poly.h>
#include <flint/arf.h>
#include <flint/arb.h>
#include <flint/acb.h>
#include <flint/qqbar.h>

int main(){
    arf_t min,max;
    arb_t arb;
    acb_t acb;
    fmpz_poly_t p;
    qqbar_t a;
    slong prec = 0;
    int status;
    arf_init(min);
    arf_init(max);
    arb_init(arb);
    acb_init(acb);
    fmpz_poly_init(p);
    qqbar_init(a);
    arf_set_si_2exp_si(min,1,0);
    arf_set_si_2exp_si(max,2,0);
    arb_set_interval_arf(arb,min,max,prec);
    arb_print(arb);
    printf("\n");
    acb_set_arb(acb,arb);
    fmpz_poly_set_coeff_si(p,0,-2);
    fmpz_poly_set_coeff_si(p,2,1);
    fmpz_poly_print_pretty(p,"x");
    printf("\n");
    status = _qqbar_validate_existence_uniqueness(&(a->enclosure),p,acb,QQBAR_DEFAULT_PREC);
    printf("status:%i\n",status);

    return 0;
}

Dockerfile:

FROM debian:testing

RUN apt-get update -y; apt-get install gcc libflint-dev -y

COPY test.c .

RUN gcc -o test test.c -lflint

RUN ./test

When both file are in an otherwise empty working directory:

docker build --platform linux/arm/v7 .
=> ERROR [5/5] RUN ./test                                                                                                      0.3s
------
 > [5/5] RUN ./test:
0.279 Segmentation fault (core dumped)
------
Dockerfile:9
--------------------
   7 |     RUN gcc -o test test.c -lflint
   8 |     
   9 | >>> RUN ./test
  10 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c ./test" did not complete successfully: exit code: 139

Debian testing: docker.io/library/debian:testing@sha256:8d04ca0b1e7fedd006e3523c89ed912c882074ddb5829992942a0c6a43da6da5

Thank you for this great library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions