Assertion `n->n_neg == 0 || !num_is_zero (n)` failed on Virtuoso **with debug enabled**. It can be reproduced on the commit 2bbd7e0.

PoC:
```sql
SELECT CAST('-39999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' AS DECIMAL)
```

Compilation Command:
```bash
CC=clang-12 CXX=clang++-12 CFLAGS="-O2 -m64 -g" /root/virtuoso/configure --with-debug
```

Server log. The server was abnormally shut down due to the assertion failure.
```
07:48:30 Initializing PRNG
07:48:30 OpenLink Virtuoso Universal Server
07:48:30 Version 07.20.3239-pthreads for Linux as of Apr 29 2024 (2bbd7e0)
07:48:30 uses OpenSSL 1.1.1f  31 Mar 2020
07:48:30 uses parts of PCRE, Html Tidy
07:48:30 Database version 3126
07:48:30 SQL Optimizer enabled (max 1000 layouts)
07:48:31 Compiler unit is timed at 0.000254 msec
07:48:31 Roll forward started
07:48:31     3 transactions, 185 bytes replayed (100 %)
07:48:31 Roll forward complete
07:48:32 PL LOG: Can't get list of vad packages in ../vad/
07:48:32 Checkpoint started
07:48:32 Checkpoint finished, log reused
07:48:32 HTTP/WebDAV server online at 8890
07:48:32 Server online at 1111 (pid 924)
virtuoso-t: numeric.c:1399: int _numeric_normalize(numeric_t): Assertion `n->n_neg == 0 || !num_is_zero (n)' failed.
fish: '/root/virtuoso-original/binsrc/…' terminated by signal SIGABRT (Abort)
```

On the non-debug version, the server works normally. The output of the SQL is: `*** Error 22003: [Virtuoso Driver][Virtuoso Server]SR127: Can't convert -39999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 to numeric`.
Assertion 'n->n_neg == 0 || !num_is_zero (n)' failed when compiled with --with-debug
This is a GitHub Issue
repo:virtuoso-opensource
owner:openlink
Title : Assertion 'n->n_neg == 0 || !num_is_zero (n)' failed when compiled with --with-debug
Issue date:

--- start body ---
Assertion `n->n_neg == 0 || !num_is_zero (n)` failed on Virtuoso **with debug enabled**. It can be reproduced on the commit 2bbd7e0.

PoC:
```sql
SELECT CAST('-39999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' AS DECIMAL)
```

Compilation Command:
```bash
CC=clang-12 CXX=clang++-12 CFLAGS="-O2 -m64 -g" /root/virtuoso/configure --with-debug
```

Server log. The server was abnormally shut down due to the assertion failure.
```
07:48:30 Initializing PRNG
07:48:30 OpenLink Virtuoso Universal Server
07:48:30 Version 07.20.3239-pthreads for Linux as of Apr 29 2024 (2bbd7e0)
07:48:30 uses OpenSSL 1.1.1f  31 Mar 2020
07:48:30 uses parts of PCRE, Html Tidy
07:48:30 Database version 3126
07:48:30 SQL Optimizer enabled (max 1000 layouts)
07:48:31 Compiler unit is timed at 0.000254 msec
07:48:31 Roll forward started
07:48:31     3 transactions, 185 bytes replayed (100 %)
07:48:31 Roll forward complete
07:48:32 PL LOG: Can't get list of vad packages in ../vad/
07:48:32 Checkpoint started
07:48:32 Checkpoint finished, log reused
07:48:32 HTTP/WebDAV server online at 8890
07:48:32 Server online at 1111 (pid 924)
virtuoso-t: numeric.c:1399: int _numeric_normalize(numeric_t): Assertion `n->n_neg == 0 || !num_is_zero (n)' failed.
fish: '/root/virtuoso-original/binsrc/…' terminated by signal SIGABRT (Abort)
```

On the non-debug version, the server works normally. The output of the SQL is: `*** Error 22003: [Virtuoso Driver][Virtuoso Server]SR127: Can't convert -39999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 to numeric`.
--- end body ---
