The R Project SVN R

Rev

Rev 49607 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 49607 Rev 77879
Line 8... Line 8...
8
 
8
 
9
#ifdef HAVE_CONFIG_H
9
#ifdef HAVE_CONFIG_H
10
#include <config.h>
10
#include <config.h>
11
#endif /* HAVE_CONFIG_H */
11
#endif /* HAVE_CONFIG_H */
12
#include <assert.h>
12
#include <assert.h>
-
 
13
#include <limits.h>
13
 
14
 
14
#include "tre-ast.h"
15
#include "tre-ast.h"
15
#include "tre-mem.h"
16
#include "tre-mem.h"
16
 
17
 
17
tre_ast_node_t *
18
tre_ast_node_t *
Line 93... Line 94...
93
  node = tre_ast_new_node(mem, CATENATION, sizeof(tre_catenation_t));
94
  node = tre_ast_new_node(mem, CATENATION, sizeof(tre_catenation_t));
94
  if (node == NULL)
95
  if (node == NULL)
95
    return NULL;
96
    return NULL;
96
  ((tre_catenation_t *)node->obj)->left = left;
97
  ((tre_catenation_t *)node->obj)->left = left;
97
  ((tre_catenation_t *)node->obj)->right = right;
98
  ((tre_catenation_t *)node->obj)->right = right;
-
 
99
  // UBSAN warning in clang 10: signed integer overflow
-
 
100
  double tmp = (double)left->num_submatches + (double)right->num_submatches;
-
 
101
  if (tmp >= INT_MIN && tmp <= INT_MAX)
98
  node->num_submatches = left->num_submatches + right->num_submatches;
102
      node->num_submatches = left->num_submatches + right->num_submatches;
-
 
103
  else node->num_submatches = 0;
99
 
104
 
100
  return node;
105
  return node;
101
}
106
}
102
 
107
 
103
#ifdef TRE_DEBUG
108
#ifdef TRE_DEBUG