Skip to content

Commit 55a39f1

Browse files
committed
Merge remote-tracking branch 'github/10.11' into 10.11
2 parents bea8c6a + 67d2d73 commit 55a39f1

39 files changed

+234
-113
lines changed

client/mysql.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,9 +1387,7 @@ int main(int argc,char *argv[])
13871387
if (opt_outfile)
13881388
end_tee();
13891389
mysql_end(0);
1390-
#ifndef _lint
1391-
DBUG_RETURN(0); // Keep compiler happy
1392-
#endif
1390+
DBUG_RETURN(0);
13931391
}
13941392

13951393
sig_handler mysql_end(int sig)
@@ -3499,8 +3497,6 @@ static int com_go(String *buffer, char *)
34993497
old_buffer.copy();
35003498
}
35013499

3502-
/* Remove garbage for nicer messages */
3503-
LINT_INIT_STRUCT(buff[0]);
35043500
remove_cntrl(*buffer);
35053501

35063502
if (buffer->is_empty())

cmake/maintainer.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ IF(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS
6868
SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=non-virtual-dtor) # gcc bug 7302
6969
ENDIF()
7070

71+
FOREACH(LANG C CXX)
72+
IF(CMAKE_${LANG}_COMPILER_ID MATCHES "Clang")
73+
MY_CHECK_AND_SET_COMPILER_FLAG(-Werror=uninitialized-explicit-init)
74+
MY_CHECK_AND_SET_COMPILER_FLAG(-Werror=uninitialized-const-reference)
75+
SET(CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS} -Werror=uninitialized")
76+
ENDIF()
77+
ENDFOREACH()
78+
7179
IF(MYSQL_MAINTAINER_MODE MATCHES "OFF|WARN")
7280
RETURN()
7381
ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO")

include/m_string.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ extern const char _dig_vec_lower[];
7979

8080
extern char *strmov_overlapp(char *dest, const char *src);
8181

82-
#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
83-
#define LINT_INIT_STRUCT(var) bzero(&var, sizeof(var)) /* No uninitialize-warning */
84-
#else
85-
#define LINT_INIT_STRUCT(var)
86-
#endif
87-
8882
/* Prototypes for string functions */
8983

9084
extern void bmove_upp(uchar *dst,const uchar *src,size_t len);

include/my_dbug.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#ifdef __cplusplus
2525
extern "C" {
2626
#endif
27-
#if !defined(DBUG_OFF) && !defined(_lint)
27+
#if !defined(DBUG_OFF)
2828

2929
struct _db_stack_frame_ {
3030
const char *func; /* function name of the previous stack frame */
@@ -210,7 +210,7 @@ extern void (*my_dbug_assert_failed)(const char *assert_expr, const char* file,
210210
#define DBUG_ASSERT(A) do { } while(0)
211211
#define IF_DBUG_ASSERT(A,B) B
212212
#endif /* DBUG_ASSERT_AS_PRINTF */
213-
#endif /* !defined(DBUG_OFF) && !defined(_lint) */
213+
#endif /* !defined(DBUG_OFF) */
214214

215215
#ifdef EXTRA_DEBUG
216216
/**

include/my_global.h

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,6 @@ C_MODE_END
281281
#error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile"
282282
#endif
283283

284-
#if defined(_lint) && !defined(lint)
285-
#define lint
286-
#endif
287-
288284
#ifndef stdin
289285
#include <stdio.h>
290286
#endif
@@ -448,22 +444,19 @@ extern "C" int madvise(void *addr, size_t len, int behav);
448444
/*
449445
Suppress uninitialized variable warning without generating code.
450446
*/
451-
#if defined(__GNUC__)
452-
/* GCC specific self-initialization which inhibits the warning. */
447+
#if defined(__GNUC__) && !defined(WITH_UBSAN)
448+
/*
449+
GCC specific self-initialization which inhibits the warning.
450+
clang and static analysis will complain loudly about this
451+
so compile those under WITH_UBSAN.
452+
*/
453453
#define UNINIT_VAR(x) x= x
454-
#elif defined(_lint) || defined(FORCE_INIT_OF_VARS)
454+
#elif defined(FORCE_INIT_OF_VARS)
455455
#define UNINIT_VAR(x) x= 0
456456
#else
457457
#define UNINIT_VAR(x) x
458458
#endif
459459

460-
/* This is only to be used when resetting variables in a class constructor */
461-
#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
462-
#define LINT_INIT(x) x= 0
463-
#else
464-
#define LINT_INIT(x)
465-
#endif
466-
467460
#if !defined(HAVE_UINT)
468461
#undef HAVE_UINT
469462
#define HAVE_UINT
@@ -505,7 +498,7 @@ C_MODE_END
505498
#endif
506499

507500
/* We might be forced to turn debug off, if not turned off already */
508-
#if (defined(FORCE_DBUG_OFF) || defined(_lint)) && !defined(DBUG_OFF)
501+
#if defined(FORCE_DBUG_OFF) && !defined(DBUG_OFF)
509502
# define DBUG_OFF
510503
# ifdef DBUG_ON
511504
# undef DBUG_ON
@@ -527,7 +520,7 @@ typedef int my_socket; /* File descriptor for sockets */
527520
#endif
528521
/* Type for functions that handles signals */
529522
#define sig_handler RETSIGTYPE
530-
#if defined(__GNUC__) && !defined(_lint)
523+
#if defined(__GNUC__)
531524
typedef char pchar; /* Mixed prototypes can take char */
532525
typedef char puchar; /* Mixed prototypes can take char */
533526
typedef char pbool; /* Mixed prototypes can take char */

mysql-test/main/sp-bugs2.result

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,39 @@ call p2('2');
5959
drop table t1;
6060
drop procedure p1;
6161
drop procedure p2;
62+
#
63+
# MDEV-26115: Crash when calling stored function in FOR loop argument
64+
#
65+
CREATE OR REPLACE FUNCTION cnt()
66+
RETURNS INTEGER NO SQL
67+
BEGIN
68+
RETURN 3;
69+
END;
70+
$
71+
CREATE OR REPLACE PROCEDURE p1()
72+
NO SQL
73+
BEGIN
74+
DECLARE i INTEGER;
75+
FOR i IN 1..cnt() DO
76+
SELECT 1;
77+
END FOR;
78+
END;
79+
$
80+
CALL p1();
81+
1
82+
1
83+
1
84+
1
85+
1
86+
1
87+
CALL p1();
88+
1
89+
1
90+
1
91+
1
92+
1
93+
1
94+
# Clean up
95+
DROP FUNCTION cnt;
96+
DROP PROCEDURE p1;
6297
# End of 10.11 tests

mysql-test/main/sp-bugs2.test

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,34 @@ drop table t1;
6767
drop procedure p1;
6868
drop procedure p2;
6969

70+
--echo #
71+
--echo # MDEV-26115: Crash when calling stored function in FOR loop argument
72+
--echo #
73+
--delimiter $
74+
CREATE OR REPLACE FUNCTION cnt()
75+
RETURNS INTEGER NO SQL
76+
BEGIN
77+
RETURN 3;
78+
END;
79+
$
80+
81+
CREATE OR REPLACE PROCEDURE p1()
82+
NO SQL
83+
BEGIN
84+
DECLARE i INTEGER;
85+
FOR i IN 1..cnt() DO
86+
SELECT 1;
87+
END FOR;
88+
END;
89+
$
90+
91+
--delimiter ;
92+
93+
CALL p1();
94+
CALL p1();
95+
96+
--echo # Clean up
97+
DROP FUNCTION cnt;
98+
DROP PROCEDURE p1;
99+
70100
--echo # End of 10.11 tests

mysql-test/suite/encryption/r/innochecksum.result

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,14 @@ CREATE TABLE t6 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
3535
# Run innochecksum on t6
3636
# Restore the original tables
3737
# restart
38+
# Trigger AHI and test pages_hashed, pages_old as non zero from sys view
39+
SELECT STRAIGHT_JOIN COUNT(t6a.a)
40+
FROM t6 AS t6a, t6 AS t6b
41+
WHERE t6a.a = t6b.a;
42+
COUNT(t6a.a)
43+
1000
44+
SELECT SUM(pages_hashed)>0 `1`, SUM(pages_old)>0 `1`
45+
FROM sys.innodb_buffer_stats_by_table;
46+
1 1
47+
1 1
3848
DROP TABLE t1, t2, t3, t4, t5, t6;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--innodb-adaptive-hash-index=ON
2+
--innodb-buffer-pool-size=64M

mysql-test/suite/encryption/t/innochecksum.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,14 @@ if (0 && $have_debug) { # these messages sometimes fail to appear
300300
--move_file $MYSQLD_DATADIR/test/t6.ibd.backup $MYSQLD_DATADIR/test/t6.ibd
301301

302302
--source include/start_mysqld.inc
303+
304+
--echo # Trigger AHI and test pages_hashed, pages_old as non zero from sys view
305+
306+
SELECT STRAIGHT_JOIN COUNT(t6a.a)
307+
FROM t6 AS t6a, t6 AS t6b
308+
WHERE t6a.a = t6b.a;
309+
310+
SELECT SUM(pages_hashed)>0 `1`, SUM(pages_old)>0 `1`
311+
FROM sys.innodb_buffer_stats_by_table;
312+
303313
DROP TABLE t1, t2, t3, t4, t5, t6;

0 commit comments

Comments
 (0)