Commit graph

2781 commits

Author SHA1 Message Date
Fabrizio Fabbri
f0d09de88e
Fix #402 multiple-values are not returned (reverted)
Reintroduce fix for additional coverity warnings.
2017-09-19 00:16:06 -04:00
Daniel Kochmanski
7db4543051 environ: accept empty list as nil environment
To inherit current process environemnt, user has to pass `:default' as
environ (what is a default value).
2017-09-05 20:17:39 +02:00
Daniel Kochmanski
e7876023c8 cosmetic: add dot to the end of message 2017-09-05 20:16:22 +02:00
Daniel Kochmanski
5ef3d3d51d Revert "Fix additional coverity warnings."
This reverts commit 06f5697074.
2017-09-01 09:51:40 +02:00
Marius Gerbershagen
bd1c5675ce ecl_number_equalp: fix comparision with floating point infinities and NaNs 2017-08-25 18:39:27 +02:00
Marius Gerbershagen
a7fdcf5cf3 fix sign of infinity returned by expt of 0.0 and a negative number, e.g. (expt 0.0 -1.0) 2017-08-25 17:42:17 +02:00
Daniel Kochmanski
436e6a62ca pathname-match-p: fix invalid comparison
(pathname-match-p "foo" "foo?") returned T, because we had too weak
comparison. Now it returns NIL.
2017-08-18 07:59:57 +02:00
Marius Gerbershagen
5f71f728a3 disable floating point exceptions when feenableexcept is not defined 2017-08-12 13:34:11 +02:00
Marius Gerbershagen
722faa1a20 undo last two commits 2017-08-12 13:33:29 +02:00
Marius Gerbershagen
de205bb114 fix handling of floating point exceptions on certain architectures 2017-08-03 17:20:20 +02:00
Daniel Kochmanski
1dd6870cd5 cleanup: signal error if pipe couldn't be created 2017-07-21 10:41:26 +02:00
Daniel Kochmanski
00bfed0386 cleanup: remove unused variable 2017-07-21 10:14:23 +02:00
Fabrizio Fabbri
cc442ac9cd
Compiled assoc does not check arguments 2017-07-04 04:59:37 +02:00
Daniel Kochmański
9735057bc3 stacks: don't call si_set_finalizer
si_set_finalizer is CL-world function and returns 0 values. That means
in particular, that env->nvalues is changed.

In this situation, when new binding was introduced, we could lose our
nvalues, what lead to invalid multiple-value-bind (next commit will
contain a regression test).

We use unprotected version. If interrupts cause problems with it, we
may need to wrap it in disable_interrupts. Threading code uses
ecl_set_finalizer_unprotected without such wrapping though, so I
believe that should be safe.

Fixes #233.
2017-07-02 22:35:37 +02:00
Daniel Kochmański
0828b1f48a equalp: don't compare clos instance slots
Problem identified and fixed by Marius Gerbershagen. Closes #391.
2017-06-30 20:19:51 +02:00
Kris Katterjohn
91bf0c4998 Fix typo in error message: ist -> is 2017-06-29 17:29:18 -05:00
Kris Katterjohn
028ab410b2 Remove FEprogram_error_noreturn and replace uses with FEprogram_error
These two function are the same.

Here is my understanding: FEprogram_error_noreturn was introduced with
the noreturn function attribute in commit 7d9fb8bb because
FEprogram_error did not have this attribute.  However, FEprogram_error
got the noreturn function attribute in commit 790d466c.  Now there is
no reason to have both of these.

This removes FEprogram_error_noreturn and changes all calls to it
with calls to FEprogram_error instead.
2017-06-29 17:24:54 -05:00
Kris Katterjohn
643651e320 Move FEillegal_variable_name to error.d and use it where appropriate
This was local to compiler.d, but it should also be used in stacks.d.

This is used in place of the error message introduced in commit 9ff142.
2017-06-28 14:21:28 -05:00
Kris Katterjohn
f5b9430c6c Introduce FEbinding_a_constant and use it where appropriate
This is for signalling an error about binding a constant variable.

This makes the error messages originally in commits 745686, c9e732
and 4e3283 more precise.
2017-06-28 14:03:29 -05:00
Kris Katterjohn
4e3283706f No longer allow PROGV to bind constants
PROGV was allowed to bind constants in the C-compiler and the bytecode
compiler and interpreter, but the behavior would differ between them:

> (defun foo ()
    (flet ((memq (item list) (member item list :test #'eq)))
      (progv (list :test) (list :test-not)
        (memq 'bar '(bar baz quux)))))
FOO

> (foo)
(BAZ QUUX)

> (compile 'foo)
FOO

> (foo)
(BAR BAZ QUUX)

CLHS says the behavior is undefined when attempting to bind or assign
constant variables (CLHS 3.1.2.1.1.3 and the entry for defconstant).

The C-compiler and bytecode compiler and interpreter give errors when
attempting to bind or assign constant variables in lambda expressions,
LET, SETQ and various other binding/assignment forms.  So the behavior
above in PROGV is inconsistent.

Now give an error when attempting to bind a constant variable in PROGV
in the C-compiler and the bytecode compiler and interpreter.
2017-06-27 18:46:55 -05:00
Kris Katterjohn
c9e7326275 No longer allow M-V-B to bind constants in bytecode compiler/interpreter
M-V-B was allowed to lexically and dynamically bind constants in the
bytecode compiler and interpreter:

> (multiple-value-bind (pi rem) (truncate pi) pi)
3

CLHS says the behavior is undefined when attempting to bind or assign
constant variables (CLHS 3.1.2.1.1.3 and the entry for defconstant).

The C-compiler gives errors for these sorts of things, and the bytecode
compiler and interpreter gives errors when attempting to bind or assign
constant variables in lambda expressions, LET, SETQ and various other
binding/assignment forms.  So the behavior above in M-V-B is
inconsistent with the C-compiler and other parts of the bytecode
compiler and interpreter.

Now give an error when attempting to bind a constant variable in M-V-B
in the bytecode compiler and interpreter.
2017-06-27 18:44:14 -05:00
Kris Katterjohn
74568641cd No longer allow LET/LET* to bind constants in bytecode compiler/interpreter
LET/LET* were allowed to lexically and dynamically bind constants in
the bytecode compiler and interpreter:

> (let ((pi 3)) pi)
3

> (progn (defconstant +c+ 'foo) (let ((+c+ 'bar)) +c+))
BAR

> (flet ((hello () (format t "hi")))
    (let ((t nil))
      (declare (special t))
      ; Oops, now this returns a string
      (hello)))
"hi"

Plus plenty of other ways to wreak havoc on unsuspecting code.

CLHS says the behavior is undefined when attempting to bind or assign
constant variables (CLHS 3.1.2.1.1.3 and the entry for defconstant).
(Well, CLHS 3.4.1 explicitly says that constant variables cannot be
used for variables in lambda lists.)

The C-compiler gives errors for these sorts of things, and the bytecode
compiler and interpreter gives errors when attempting to bind or assign
constant variables in lambda expressions, SETQ and various other forms.
So the behavior above in LET is inconsistent with both the C-compiler
and other parts of the bytecode compiler and interpreter.

Now give an error when attempting to bind a constant variable in
LET/LET* in the bytecode compiler and interpreter.

This also changes the behavior of PROG/PROG* and DESTRUCTURING-BIND so
that they give errors when attempting to bind constants as well.
2017-06-27 18:42:20 -05:00
Kris Katterjohn
9ff1420cf5 Check for a symbol before attempting to bind it in PROGV
PROGV was attempting to bind whatever was in its variable list
without checking its type.  Using either the C-compiler or bytecode
compiler/interpreter, the following example would lead to a segfault
on my OpenBSD and Linux boxes:

> (defun foo () (progv (list 3) (list 3)))
FOO

> (foo)
Condition of type: SEGMENTATION-VIOLATION
[...]

Now give an error when attempting to bind something that is not a
symbol in PROGV (in both the C-compiler and bytecode compiler and
interpreter).
2017-06-27 18:35:24 -05:00
Kris Katterjohn
26e7802917 Stop depending on uninitialized variables when setting TCP_NODELAY
The contents of an uninitialized variable was used when setting the
TCP_NODELAY option for sockets created with open-client-stream and
open-server-stream, so this option would not be set when the value
of the variable happened to be 0 (which happened regularly on my
OpenBSD box).

Tested on OpenBSD and Linux.
2017-06-23 17:06:57 -05:00
Kris Katterjohn
0c5be44ad9 #include netinet/tcp.h so TCP_* will actually be defined
This header needs to be included so the TCP_* defines are available.
Sockets created with open-client-stream and open-server-stream would
try to set TCP_NODELAY if available, but they couldn't because this
was not defined.

Tested on OpenBSD and Linux.
2017-06-23 17:04:43 -05:00
Fabrizio Fabbri
aa23a0339f
Merge remote-tracking branch 'origin/develop' into develop 2017-06-22 00:47:10 +02:00
Yuguo Zhang
52a232b2d1 adjust memory allocation functions in windows API ecl_get_commandline_args.
the caller and the callee maybe use difference compiler and settings.
2017-06-13 18:22:59 +08:00
Fabrizio Fabbri
06f5697074
Fix additional coverity warnings. 2017-06-06 23:43:02 +02:00
Yuguo Zhang
296fea073e patch for windows ReadConsole bug 2017-06-05 10:29:23 +08:00
Fabrizio Fabbri
d73cc5013b
Coverity fix issue
Proper cleanup of vararg.
Fix buffer corruption on dpp.
2017-06-03 11:57:01 +02:00
Daniel Kochmański
a095f6a4ee ecl_thread_internal_error: provide hint what may go wrong 2017-05-25 08:19:19 +02:00
Daniel Kochmański
7ef7116589 windows: thread_internal_error: call ExitThread 2017-05-25 07:57:05 +02:00
Daniel Kochmański
052155c6c3 ecl_thread_internal_error: add C api, protect get_env
Problem reported and fixed by Marius Gerbershagen. Fixes #382.
2017-05-22 22:58:15 +02:00
Fabrizio Fabbri
95279fb15f
Code review on merge request !65 2017-05-19 19:34:19 +02:00
Fabrizio Fabbri
f8432d1f5f
coverity fix 1434978 Argument cannot be negative
https://scan7.coverity.com/reports.htm#v29378/p15116/fileInstanceId=19260861&defectInstanceId=4445893&mergedDefectId=1434978
2017-05-18 13:01:02 +02:00
Fabrizio Fabbri
a74094de9a
fix coverity issue Missing varargs init or cleanup 2017-05-17 23:20:10 +02:00
Fabrizio Fabbri
6c8449b147
fix coverity 435052 Dereference before null check
https://scan7.coverity.com/reports.htm#v29378/p15116/fileInstanceId=19259832&defectInstanceId=4445114&mergedDefectId=1435052
2017-05-17 21:11:26 +02:00
Fabrizio Fabbri
e688ca4058
coverity fix 1435189 Double close
https://scan7.coverity.com/reports.htm#v29378/p15116/fileInstanceId=19259820&defectInstanceId=4445788&mergedDefectId=1435189
2017-05-17 21:08:23 +02:00
Fabrizio Fabbri
29ad64adb7
coverity fix Missing varargs init or cleanup 2017-05-17 20:26:24 +02:00
Fabrizio Fabbri
0227f299a6
fix covrity issue 1435068 Resource leak
https://scan7.coverity.com/reports.htm#v29377/p15116/fileInstanceId=19101001&defectInstanceId=4408515&mergedDefectId=1435068
2017-05-17 19:45:51 +02:00
Fabrizio Fabbri
64a0bcebdf
fix coverity 1434960 Uninitialized pointer read
https://scan7.coverity.com/reports.htm#v29377/p15116/fileInstanceId=19088397&defectInstanceId=4404042&mergedDefectId=1434960
2017-05-16 22:00:17 +02:00
Fabrizio Fabbri
4c5f0b2162
fix coverity 1434866 Missing return statement
https://scan7.coverity.com/reports.htm#v29377/p15116/fileInstanceId=19088538&defectInstanceId=4403920&mergedDefectId=1434866
2017-05-16 22:00:09 +02:00
Fabrizio Fabbri
73ed08df0b
fix coverity issue 1434897 Uninitialized scalar variable
https://scan7.coverity.com/reports.htm#v29377/p15116/fileInstanceId=18706960&defectInstanceId=4324855&mergedDefectId=1434897&eventIds=4324837-8
2017-05-16 18:31:55 +02:00
Fabrizio Fabbri
0d18fcbbf2
fix coverity 1434941 Missing return statement
https://scan7.coverity.com/reports.htm#v29377/p15116/fileInstanceId=18706913&defectInstanceId=4323734&mergedDefectId=1434941
2017-05-16 18:19:38 +02:00
Fabrizio Fabbri
1f58875e1c
fix coverity issue 1434998 Out-of-bounds access
https://scan7.coverity.com/reports.htm#v29377/p15116/fileInstanceId=18707043&defectInstanceId=4324833&mergedDefectId=1434998
2017-05-16 18:15:44 +02:00
Fabrizio Fabbri
830f72473b
Fix Uninitialized pointer read
Coverity report https://scan7.coverity.com/reports.htm#v29377/p15116/fileInstanceId=18706970&defectInstanceId=4323844&mergedDefectId=1435043
2017-05-15 18:45:22 +02:00
Daniel Kochmanski
72e422f1b3 cleanup: remove hierarchical packages interface
It didn't work for some cases and wasn't documented, so I'm removing
it. Freshly written tests are left in tests for someone, who would
like to reimplement them.
2017-05-13 18:06:26 +02:00
Fabrizio Fabbri
a229a496f2
fix #378 fail to build on windows
HANDLE and int have different size. use _open_osfhandle.
2017-05-13 15:36:37 +02:00
Fabrizio Fabbri
bace22e62a
Close fd as earlier as possible. 2017-05-13 08:45:50 +02:00
Daniel Kochmanski
f4e25c7055 spawn-subprocess: remove pipe synchronization 2017-05-12 22:19:25 +02:00