diff mbox series

[blktests,-v2] Fix build failure for discontiguous-io on 32-bit platforms

Message ID 20181030143649.28246-1-tytso@mit.edu (mailing list archive)
State New, archived
Headers show
Series [blktests,-v2] Fix build failure for discontiguous-io on 32-bit platforms | expand

Commit Message

Theodore Ts'o Oct. 30, 2018, 2:36 p.m. UTC
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 src/discontiguous-io.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bart Van Assche Oct. 30, 2018, 3:02 p.m. UTC | #1
On Tue, 2018-10-30 at 10:36 -0400, Theodore Ts'o wrote:
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
>  src/discontiguous-io.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/discontiguous-io.cpp b/src/discontiguous-io.cpp
> index 5e0ee0f..f51a305 100644
> --- a/src/discontiguous-io.cpp
> +++ b/src/discontiguous-io.cpp
> @@ -251,7 +251,7 @@ int main(int argc, char **argv)
>  	const char *dev;
>  	int c;
>  	std::vector<uint8_t> buf;
> -	size_t len = 512;
> +	unsigned long len = 512;
>  
>  	while ((c = getopt(argc, argv, "hl:o:sw")) != EOF) {
>  		switch (c) {

Details about how the build fails on 32-bit systems would have been welcome
in the commit message. Anyway:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Theodore Ts'o Oct. 30, 2018, 4:02 p.m. UTC | #2
On Tue, Oct 30, 2018 at 08:02:55AM -0700, Bart Van Assche wrote:
> Details about how the build fails on 32-bit systems would have been welcome
> in the commit message. Anyway:
> 
> Reviewed-by: Bart Van Assche <bvanassche@acm.org>

For the record, here's the failure.  It's the usual incomprehensible
C++ error reporting.  :-)

% schroot -c stretch-i386 -- ./build-all --blktests-only
----------------- 2018-10-30 16:00:18: Starting build of blktests
make -C src all
make[1]: Entering directory '/usr/projects/xfstests-bld/build-32/blktests/src'
g++  -O2 -std=c++11 -Wall -Wextra -Wno-sign-compare -Werror -o discontiguous-io discontiguous-io.cpp
discontiguous-io.cpp: In function 'int main(int, char**)':
discontiguous-io.cpp:294:34: error: no matching function for call to 'min(long unsigned int, size_t)'
         std::min(4ul, len - i * 4));
                                  ^
In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                 from /usr/include/c++/6/string:40,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/iomanip:40,
                 from discontiguous-io.cpp:8:
/usr/include/c++/6/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/6/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
discontiguous-io.cpp:294:34: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'size_t {aka unsigned int}')
         std::min(4ul, len - i * 4));
                                  ^
In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                 from /usr/include/c++/6/string:40,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/iomanip:40,
                 from discontiguous-io.cpp:8:
/usr/include/c++/6/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/6/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
discontiguous-io.cpp:294:34: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'size_t {aka unsigned int}')
         std::min(4ul, len - i * 4));
                                  ^
Makefile:27: recipe for target 'discontiguous-io' failed
make[1]: *** [discontiguous-io] Error 1
make[1]: Leaving directory '/usr/projects/xfstests-bld/build-32/blktests/src'
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 2
Bart Van Assche Oct. 30, 2018, 5:19 p.m. UTC | #3
On Tue, 2018-10-30 at 12:02 -0400, Theodore Y. Ts'o wrote:
> On Tue, Oct 30, 2018 at 08:02:55AM -0700, Bart Van Assche wrote:
> > Details about how the build fails on 32-bit systems would have been welcome
> > in the commit message. Anyway:
> > 
> > Reviewed-by: Bart Van Assche <bvanassche@acm.org>
> 
> For the record, here's the failure.  It's the usual incomprehensible
> C++ error reporting.  :-)
> 
> [ ... ]
> discontiguous-io.cpp: In function 'int main(int, char**)':
> discontiguous-io.cpp:294:34: error: no matching function for call to 'min(long unsigned int, size_t)'
>          std::min(4ul, len - i * 4));
>                                   ^
> [ ... ]

Thanks Ted for having provided the full compiler output. However, I don't
think that the entire error message should go in the commit message. To me,
the part of the compiler error message I cited tells the whole story :-)

Bart.
diff mbox series

Patch

diff --git a/src/discontiguous-io.cpp b/src/discontiguous-io.cpp
index 5e0ee0f..f51a305 100644
--- a/src/discontiguous-io.cpp
+++ b/src/discontiguous-io.cpp
@@ -251,7 +251,7 @@  int main(int argc, char **argv)
 	const char *dev;
 	int c;
 	std::vector<uint8_t> buf;
-	size_t len = 512;
+	unsigned long len = 512;
 
 	while ((c = getopt(argc, argv, "hl:o:sw")) != EOF) {
 		switch (c) {