From: Domingo Alvarez Duarte <mingodad@gmail.com>
To: musl@lists.openwall.com
Subject: [musl] Bug in atoll strtoll, the output of then differ
Date: Sun, 18 Dec 2022 10:32:10 +0100 [thread overview]
Message-ID: <f1c6f16a-a6fd-8447-5f9b-d3d25a044af4@gmail.com> (raw)
Hello !
Doing some work with emscripten with this project
https://github.com/mingodad/CG-SQL-Lua-playground I was getting some
errors with the usage of "atoll" and with this small program to compare
the output of "musl" and "glibc" I found what seems to be a bug in
"atoll" because with "musl" it gives a different output than "strtoll".
=====
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
const char *s = "9223372036854775808";
long long ll = atoll(s);
long long ll2 = strtoll (s, (char **) NULL, 10);
int imax = 0x7fffffff;
printf("%s : %lld : %lld : %d : %d\n", s, ll, ll2, imax, ll <= imax);
return 0;
}
=====
Output from "glibc":
=====
9223372036854775808 : 9223372036854775807 : 9223372036854775807 :
2147483647 : 0
=====
Output from "musl":
=====
9223372036854775808 : -9223372036854775808 : 9223372036854775807 :
2147483647 : 1
=====
Cheers !
next reply other threads:[~2022-12-18 9:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-18 9:32 Domingo Alvarez Duarte [this message]
2022-12-18 9:58 ` Markus Wichmann
2022-12-18 10:22 ` Domingo Alvarez Duarte
2022-12-18 11:10 ` Markus Wichmann
2022-12-18 10:06 ` Quentin Rameau
2022-12-18 12:23 ` Szabolcs Nagy
2022-12-18 15:25 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f1c6f16a-a6fd-8447-5f9b-d3d25a044af4@gmail.com \
--to=mingodad@gmail.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).