| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: tree.c,v 1.311 2021/07/04 17:16:09 rillig Exp $ */ | | 1 | /* $NetBSD: tree.c,v 1.312 2021/07/04 17:28:05 rillig Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1994, 1995 Jochen Pohl | | 4 | * Copyright (c) 1994, 1995 Jochen Pohl |
5 | * All Rights Reserved. | | 5 | * All Rights Reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -27,27 +27,27 @@ | | | @@ -27,27 +27,27 @@ |
27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #if HAVE_NBTOOL_CONFIG_H | | 34 | #if HAVE_NBTOOL_CONFIG_H |
35 | #include "nbtool_config.h" | | 35 | #include "nbtool_config.h" |
36 | #endif | | 36 | #endif |
37 | | | 37 | |
38 | #include <sys/cdefs.h> | | 38 | #include <sys/cdefs.h> |
39 | #if defined(__RCSID) && !defined(lint) | | 39 | #if defined(__RCSID) && !defined(lint) |
40 | __RCSID("$NetBSD: tree.c,v 1.311 2021/07/04 17:16:09 rillig Exp $"); | | 40 | __RCSID("$NetBSD: tree.c,v 1.312 2021/07/04 17:28:05 rillig Exp $"); |
41 | #endif | | 41 | #endif |
42 | | | 42 | |
43 | #include <float.h> | | 43 | #include <float.h> |
44 | #include <limits.h> | | 44 | #include <limits.h> |
45 | #include <math.h> | | 45 | #include <math.h> |
46 | #include <signal.h> | | 46 | #include <signal.h> |
47 | #include <stdlib.h> | | 47 | #include <stdlib.h> |
48 | #include <string.h> | | 48 | #include <string.h> |
49 | | | 49 | |
50 | #include "lint1.h" | | 50 | #include "lint1.h" |
51 | #include "cgram.h" | | 51 | #include "cgram.h" |
52 | | | 52 | |
53 | static tnode_t *expr_new_integer_constant(tspec_t, int64_t); | | 53 | static tnode_t *expr_new_integer_constant(tspec_t, int64_t); |
| @@ -718,27 +718,27 @@ cconv(tnode_t *tn) | | | @@ -718,27 +718,27 @@ cconv(tnode_t *tn) |
718 | } | | 718 | } |
719 | | | 719 | |
720 | /* | | 720 | /* |
721 | * Expression of type function (function with return value of type T) | | 721 | * Expression of type function (function with return value of type T) |
722 | * in rvalue-expression (pointer to function with return value | | 722 | * in rvalue-expression (pointer to function with return value |
723 | * of type T) | | 723 | * of type T) |
724 | */ | | 724 | */ |
725 | if (tn->tn_type->t_tspec == FUNC) | | 725 | if (tn->tn_type->t_tspec == FUNC) |
726 | tn = build_address(tn, true); | | 726 | tn = build_address(tn, true); |
727 | | | 727 | |
728 | /* lvalue to rvalue */ | | 728 | /* lvalue to rvalue */ |
729 | if (tn->tn_lvalue) { | | 729 | if (tn->tn_lvalue) { |
730 | tp = expr_dup_type(tn->tn_type); | | 730 | tp = expr_dup_type(tn->tn_type); |
731 | /* FIXME: even rvalues can be const/volatile, see msg_101 */ | | 731 | /* C99 6.3.2.1p2 sentence 2 says to remove the qualifiers. */ |
732 | tp->t_const = tp->t_volatile = false; | | 732 | tp->t_const = tp->t_volatile = false; |
733 | tn = new_tnode(LOAD, tp, tn, NULL); | | 733 | tn = new_tnode(LOAD, tp, tn, NULL); |
734 | } | | 734 | } |
735 | | | 735 | |
736 | return tn; | | 736 | return tn; |
737 | } | | 737 | } |
738 | | | 738 | |
739 | const tnode_t * | | 739 | const tnode_t * |
740 | before_conversion(const tnode_t *tn) | | 740 | before_conversion(const tnode_t *tn) |
741 | { | | 741 | { |
742 | while (tn->tn_op == CVT && !tn->tn_cast) | | 742 | while (tn->tn_op == CVT && !tn->tn_cast) |
743 | tn = tn->tn_left; | | 743 | tn = tn->tn_left; |
744 | return tn; | | 744 | return tn; |