Skip to content

Commit b5b3b2d

Browse files
author
ripley
committed
avoid UBSAN message
git-svn-id: https://svn.r-project.org/R/trunk@87483 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent f7578ae commit b5b3b2d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/library/grid/src/unit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* R : A Computer Language for Statistical Data Analysis
33
* Copyright (C) 2001-3 Paul Murrell
4-
* 2003-2020 The R Core Team
4+
* 2003-2024 The R Core Team
55
*
66
* This program is free software; you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -1949,7 +1949,7 @@ SEXP summaryUnits(SEXP units, SEXP op_type) {
19491949
SET_STRING_ELT(cl, 0, mkChar("unit"));
19501950
SET_STRING_ELT(cl, 1, mkChar("unit_v2"));
19511951

1952-
int is_type[m];
1952+
int is_type[m > 0 ? m : 1L]; // mmight be zero which would not be legal C.
19531953
int all_type = 1;
19541954

19551955
for (int i = 0; i < n; i++) {

0 commit comments

Comments
 (0)