Code Monkey home page Code Monkey logo

c-quadratic-sieve's Issues

Compiling with -O3 on GCC 12.2.0 results in two compiler warnings

steps to reproduce:

$ gcc main.c -O3 -o qs

In file included from main.c:2:
In function ‘cint_erase’,
    inlined from ‘cint_right_shifti’ at cint.c:286:9,
    inlined from ‘cint_sqrt.part.0’ at cint.c:536:4:
cint.c:107:34: warning: ‘memset’ specified size between 9223372036854775808 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
  107 |         num->nat = 1, num->end = memset(num->mem, 0, (num->end - num->mem) * sizeof(h_cint_t));
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘cint_right_shifti’,
    inlined from ‘cint_sqrt.part.0’ at cint.c:536:4:
cint.c:278:31: note: destination object allocated here
  278 |         if (num->end - a > num->mem) {
      |                            ~~~^~~~~
In function ‘cint_erase’,
    inlined from ‘cint_right_shifti’ at cint.c:286:9,
    inlined from ‘cint_sqrt.part.0’ at cint.c:539:4:
cint.c:107:34: warning: ‘memset’ specified size between 9223372036854775808 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
  107 |         num->nat = 1, num->end = memset(num->mem, 0, (num->end - num->mem) * sizeof(h_cint_t));
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘cint_right_shifti’,
    inlined from ‘cint_sqrt.part.0’ at cint.c:539:4:
cint.c:278:31: note: destination object allocated here
  278 |         if (num->end - a > num->mem) {
      |                            ~~~^~~~~

Version of gcc:
gcc (Debian 12.2.0-14) 12.2.0

The program appears to function normally despite the warnings, and valgrind doesn't detect any memory leaks. The warning doesn't appear with -O2.

potential divide by zero?

Is that an intentional divide-by-zero at line 218 of fac_utils.c ?
} else b = (n == 0) / 0.;

Also, at line 55 of cint.c, is there any reason why cint_clear_sheet() is not also static ?
void cint_clear_sheet(cint_sheet *sheet) {

Segmentation fault with "./qs 705074515857134286120871238142845541623" on WSL

Hello,
I am very gratefull for this project and would like to support it (threading/GPU would be nice)...
Everything seem to work fine most of the time but on Linux WSL at least... i get some segfaults every now an then :
27. 705074515857134286120871238142845541623 = Segmentation fault

The number 705074515857134286120871238142845541623 gives error for me, I tried with -O1... same
I'll dig in a bit more with a debugger...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.