Opened 3 years ago

Closed 3 years ago

#673 closed ожидается проверка (задача сдана)

WW #13

Reported by: Pavlova Aleksandra Owned by: Святослав Власов
Component: WW_array Version: 1.0
Keywords: Cc:

Description


Change History (1)

comment:1 Changed 3 years ago by Святослав Власов

Resolution: задача сдана
Status: assignedclosed

Компиляция булевой специализации рухнула с кучей ошибок:

In file included from src/main.cpp:1:
include/my_array.h: In function ‘void test_fill() [with T = bool; long unsigned int N = 50; long unsigned int val = 0]’:
include/my_array.h:133:13: error: iteration 7 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
include/my_array.h:132:29: note: within this loop
  132 |   for (std::size_t i = 0; i < N; i++)
      |                           ~~^~~
include/my_array.h: In function ‘void test_fill() [with T = bool; long unsigned int N = 50; long unsigned int val = 1]’:
include/my_array.h:133:13: error: iteration 7 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
include/my_array.h:132:29: note: within this loop
  132 |   for (std::size_t i = 0; i < N; i++)
      |                           ~~^~~
include/my_array.h: In function ‘void test_bool_write_int() [with long unsigned int N = 50; int val = 0]’:
include/my_array.h:133:13: error: iteration 7 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
include/my_array.h:132:29: note: within this loop
  132 |   for (std::size_t i = 0; i < N; i++)
      |                           ~~^~~
include/my_array.h: In function ‘void test_bool_write_int() [with long unsigned int N = 50; int val = 1]’:
include/my_array.h:133:13: error: iteration 7 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
include/my_array.h:132:29: note: within this loop
  132 |   for (std::size_t i = 0; i < N; i++)
      |                           ~~^~~
include/my_array.h: In function ‘void test_bool_write_int() [with long unsigned int N = 50; int val = 2]’:
include/my_array.h:133:13: error: iteration 7 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
include/my_array.h:132:29: note: within this loop
  132 |   for (std::size_t i = 0; i < N; i++)
      |                           ~~^~~
include/my_array.h: In function ‘void test_bool_fill_int() [with long unsigned int N = 50; int val = 0]’:
include/my_array.h:133:13: error: iteration 7 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
include/my_array.h:132:29: note: within this loop
  132 |   for (std::size_t i = 0; i < N; i++)
      |                           ~~^~~
include/my_array.h: In function ‘void test_bool_fill_int() [with long unsigned int N = 50; int val = 1]’:
include/my_array.h:133:13: error: iteration 7 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
include/my_array.h:132:29: note: within this loop
  132 |   for (std::size_t i = 0; i < N; i++)
      |                           ~~^~~
include/my_array.h: In function ‘void test_bool_fill_int() [with long unsigned int N = 50; int val = 2]’:
include/my_array.h:133:13: error: iteration 7 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
include/my_array.h:132:29: note: within this loop
  132 |   for (std::size_t i = 0; i < N; i++)
      |                           ~~^~~
include/my_array.h: In function ‘void test_chain_assign(const T&) [with T = bool; long unsigned int N = 50]’:
include/my_array.h:133:13: error: iteration 7 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
include/my_array.h:132:29: note: within this loop
  132 |   for (std::size_t i = 0; i < N; i++)
      |                           ~~^~~
include/my_array.h:133:13: error: iteration 7 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
include/my_array.h:132:29: note: within this loop
  132 |   for (std::size_t i = 0; i < N; i++)
      |                           ~~^~~
include/my_array.h: In function ‘void test_write_read() [with T = bool; long unsigned int N = 50]’:
include/my_array.h:75:31: error: ‘a.lab_13::my_array<bool, 50>::_data[0]’ is used uninitialized in this function [-Werror=uninitialized]
   75 |     _bits(bits), _pos(1 << pos) {}
      |                               ^
src/main.cpp: In function ‘void test_copy() [with T = bool; long unsigned int N = 50]’:
src/main.cpp:128:18: error: ‘a1’ is used uninitialized in this function [-Werror=uninitialized]
  128 |   my_array<T, N> a2 = a1;
      |                  ^~
In file included from src/main.cpp:1:
In member function ‘void lab_13::my_array<bool, N>::fill(bool) [with long unsigned int N = 50]’,
    inlined from ‘void test_fill() [with T = bool; long unsigned int N = 50; long unsigned int val = 0]’ at src/main.cpp:143:9:
include/my_array.h:133:13: error: ‘void* __builtin_memset(void*, int, long unsigned int)’ forming offset [7, 49] is out of the bounds [0, 7] of object ‘a’ with type ‘lab_13::my_array<bool, 50>’ [-Werror=array-bounds]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
src/main.cpp: In function ‘void test_fill() [with T = bool; long unsigned int N = 50; long unsigned int val = 0]’:
src/main.cpp:139:18: note: ‘a’ declared here
  139 |   my_array<T, N> a;
      |                  ^
In file included from src/main.cpp:1:
In member function ‘void lab_13::my_array<bool, N>::fill(bool) [with long unsigned int N = 50]’,
    inlined from ‘void test_fill() [with T = bool; long unsigned int N = 50; long unsigned int val = 1]’ at src/main.cpp:143:9:
include/my_array.h:133:13: error: ‘void* __builtin_memset(void*, int, long unsigned int)’ forming offset [7, 49] is out of the bounds [0, 7] of object ‘a’ with type ‘lab_13::my_array<bool, 50>’ [-Werror=array-bounds]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
src/main.cpp: In function ‘void test_fill() [with T = bool; long unsigned int N = 50; long unsigned int val = 1]’:
src/main.cpp:139:18: note: ‘a’ declared here
  139 |   my_array<T, N> a;
      |                  ^
In file included from src/main.cpp:1:
In member function ‘void lab_13::my_array<bool, N>::fill(bool) [with long unsigned int N = 50]’,
    inlined from ‘void test_bool_write_int() [with long unsigned int N = 50; int val = 0]’ at src/main.cpp:193:9:
include/my_array.h:133:13: error: ‘void* __builtin_memset(void*, int, long unsigned int)’ forming offset [7, 49] is out of the bounds [0, 7] of object ‘a’ with type ‘lab_13::my_array<bool, 50>’ [-Werror=array-bounds]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
src/main.cpp: In function ‘void test_bool_write_int() [with long unsigned int N = 50; int val = 0]’:
src/main.cpp:192:21: note: ‘a’ declared here
  192 |   my_array<bool, N> a;
      |                     ^
In file included from src/main.cpp:1:
In member function ‘void lab_13::my_array<bool, N>::fill(bool) [with long unsigned int N = 50]’,
    inlined from ‘void test_bool_write_int() [with long unsigned int N = 50; int val = 1]’ at src/main.cpp:193:9:
include/my_array.h:133:13: error: ‘void* __builtin_memset(void*, int, long unsigned int)’ forming offset [7, 49] is out of the bounds [0, 7] of object ‘a’ with type ‘lab_13::my_array<bool, 50>’ [-Werror=array-bounds]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
src/main.cpp: In function ‘void test_bool_write_int() [with long unsigned int N = 50; int val = 1]’:
src/main.cpp:192:21: note: ‘a’ declared here
  192 |   my_array<bool, N> a;
      |                     ^
In file included from src/main.cpp:1:
In member function ‘void lab_13::my_array<bool, N>::fill(bool) [with long unsigned int N = 50]’,
    inlined from ‘void test_bool_write_int() [with long unsigned int N = 50; int val = 2]’ at src/main.cpp:193:9:
include/my_array.h:133:13: error: ‘void* __builtin_memset(void*, int, long unsigned int)’ forming offset [7, 49] is out of the bounds [0, 7] of object ‘a’ with type ‘lab_13::my_array<bool, 50>’ [-Werror=array-bounds]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
src/main.cpp: In function ‘void test_bool_write_int() [with long unsigned int N = 50; int val = 2]’:
src/main.cpp:192:21: note: ‘a’ declared here
  192 |   my_array<bool, N> a;
      |                     ^
In file included from src/main.cpp:1:
In member function ‘void lab_13::my_array<bool, N>::fill(bool) [with long unsigned int N = 50]’,
    inlined from ‘void test_bool_fill_int() [with long unsigned int N = 50; int val = 0]’ at src/main.cpp:206:9:
include/my_array.h:133:13: error: ‘void* __builtin_memset(void*, int, long unsigned int)’ forming offset [7, 49] is out of the bounds [0, 7] of object ‘a’ with type ‘lab_13::my_array<bool, 50>’ [-Werror=array-bounds]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
src/main.cpp: In function ‘void test_bool_fill_int() [with long unsigned int N = 50; int val = 0]’:
src/main.cpp:205:21: note: ‘a’ declared here
  205 |   my_array<bool, N> a;
      |                     ^
In file included from src/main.cpp:1:
In member function ‘void lab_13::my_array<bool, N>::fill(bool) [with long unsigned int N = 50]’,
    inlined from ‘void test_bool_fill_int() [with long unsigned int N = 50; int val = 1]’ at src/main.cpp:206:9:
include/my_array.h:133:13: error: ‘void* __builtin_memset(void*, int, long unsigned int)’ forming offset [7, 49] is out of the bounds [0, 7] of object ‘a’ with type ‘lab_13::my_array<bool, 50>’ [-Werror=array-bounds]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
src/main.cpp: In function ‘void test_bool_fill_int() [with long unsigned int N = 50; int val = 1]’:
src/main.cpp:205:21: note: ‘a’ declared here
  205 |   my_array<bool, N> a;
      |                     ^
In file included from src/main.cpp:1:
In member function ‘void lab_13::my_array<bool, N>::fill(bool) [with long unsigned int N = 50]’,
    inlined from ‘void test_bool_fill_int() [with long unsigned int N = 50; int val = 2]’ at src/main.cpp:206:9:
include/my_array.h:133:13: error: ‘void* __builtin_memset(void*, int, long unsigned int)’ forming offset [7, 49] is out of the bounds [0, 7] of object ‘a’ with type ‘lab_13::my_array<bool, 50>’ [-Werror=array-bounds]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
src/main.cpp: In function ‘void test_bool_fill_int() [with long unsigned int N = 50; int val = 2]’:
src/main.cpp:205:21: note: ‘a’ declared here
  205 |   my_array<bool, N> a;
      |                     ^
In file included from src/main.cpp:1:
include/my_array.h: In function ‘void test_write_read_proxy() [with T = bool; long unsigned int N = 50]’:
include/my_array.h:75:31: error: ‘a.lab_13::my_array<bool, 50>::_data[<unknown>]’ is used uninitialized in this function [-Werror=uninitialized]
   75 |     _bits(bits), _pos(1 << pos) {}
      |                               ^
include/my_array.h:75:31: error: ‘a.lab_13::my_array<bool, 50>::_data[<unknown>]’ is used uninitialized in this function [-Werror=uninitialized]
   75 |     _bits(bits), _pos(1 << pos) {}
      |                               ^
include/my_array.h:75:31: error: ‘a.lab_13::my_array<bool, 50>::_data[<unknown>]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   75 |     _bits(bits), _pos(1 << pos) {}
      |                               ^
include/my_array.h:75:31: error: ‘a.lab_13::my_array<bool, 50>::_data[0]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   75 |     _bits(bits), _pos(1 << pos) {}
      |                               ^
include/my_array.h:75:31: error: ‘a.lab_13::my_array<bool, 50>::_data[<unknown>]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   75 |     _bits(bits), _pos(1 << pos) {}
      |                               ^
include/my_array.h:75:31: error: ‘a.lab_13::my_array<bool, 50>::_data[<unknown>]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   75 |     _bits(bits), _pos(1 << pos) {}
      |                               ^
include/my_array.h:75:31: error: ‘a.lab_13::my_array<bool, 50>::_data[<unknown>]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   75 |     _bits(bits), _pos(1 << pos) {}
      |                               ^
include/my_array.h:75:31: error: ‘a.lab_13::my_array<bool, 50>::_data[6]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   75 |     _bits(bits), _pos(1 << pos) {}
      |                               ^
In member function ‘void lab_13::my_array<bool, N>::fill(bool) [with long unsigned int N = 50]’,
    inlined from ‘void test_chain_assign(const T&) [with T = bool; long unsigned int N = 50]’ at src/main.cpp:178:11:
include/my_array.h:133:13: error: ‘void* __builtin_memset(void*, int, long unsigned int)’ forming offset [7, 49] is out of the bounds [0, 7] of object ‘a’ with type ‘lab_13::my_array<bool, 50>’ [-Werror=array-bounds]
  133 |    _data[i] = v;
      |    ~~~~~~~~~^~~
src/main.cpp: In function ‘void test_chain_assign(const T&) [with T = bool; long unsigned int N = 50]’:
src/main.cpp:177:20: note: ‘a’ declared here
  177 |     my_array<T, N> a;
      |                    ^
cc1plus: all warnings being treated as errors
make: *** [Makefile:17: obj/main.o] Error 1
[Custom Main] Build with custom main.cpp failed

Тесты на доступ к элементам массива попадали по ассертам (потому что они неправильные)

Только 2/10

Note: See TracTickets for help on using tickets.