Bug #43461 invalid comparison with string literal in default.c
Submitted: 6 Mar 2009 17:04 Modified: 13 Apr 2009 19:24
Reporter: Mark Callaghan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0,5.1 OS:Any
Assigned to: Davi Arnaut CPU Architecture:Any
Tags: compiler, warning

[6 Mar 2009 17:04] Mark Callaghan
Description:
This warning:
warning: comparison with string literal results in unspecified behavior

Is generated by gcc 4.3.1 when mysys/default.c is compiled with -Wall

This is the code:

#if defined(DEFAULT_SYSCONFDIR)
  if (DEFAULT_SYSCONFDIR != "")
    errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
#endif /* DEFAULT_SYSCONFDIR */

How to repeat:
Compile with gcc 4.3 and -Wall
[6 Mar 2009 21:25] Sveta Smirnova
Thank you for the report.

Verified as described.

There are same errors in other files:

my_new.cc:50: warning: comparison with string literal results in unspecified behaviour
default.c:1093: warning: comparison with string literal results in unspecified behavior
./../include/runtime.hpp:63: warning: comparison with string literal results in unspecified behaviour
./../taocrypt/include/runtime.hpp:63: warning: comparison with string literal results in unspecified behaviour
../mysys/my_new.cc:50: warning: comparison with string literal results in unspecified behaviour
sql_class.cc:2299: warning: comparison with string literal results in unspecified behaviour
[19 Mar 2009 14:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/69820

2782 Davi Arnaut	2009-03-19
      Bug#43461: invalid comparison with string literal in default.c
      
      Don't compare string literals as it results in unspecified behavior.
[19 Mar 2009 14:11] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/69822

2782 Davi Arnaut	2009-03-19
      Bug#43461: invalid comparison with string literal in default.c
      
      Don't compare string literals as it results in unspecified behavior.
[19 Mar 2009 20:20] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/69866

2782 Davi Arnaut	2009-03-19
      Bug#43461: invalid comparison with string literal in default.c
      
      Don't compare string literals as it results in unspecified behavior.
     @ mysys/default.c
        Test for a empty string.
[19 Mar 2009 20:21] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/69867

2744 Davi Arnaut	2009-03-19
      Bug#43461: invalid comparison with string literal in default.c
      
      Don't compare string literals as it results in unspecified behavior.
     @ mysys/default.c
        Test for a empty string.
[19 Mar 2009 20:32] Davi Arnaut
Queued to 5.0-bugteam
[27 Mar 2009 14:31] Bugs System
Pushed into 5.0.80 (revid:joro@sun.com-20090327142516-55gumdxj39z6eijj) (version source revid:leonard@mysql.com-20090324072904-7w2lxdxzw8hx1rnm) (merge vers: 5.0.80) (pib:6)
[27 Mar 2009 14:56] Bugs System
Pushed into 5.1.34 (revid:joro@sun.com-20090327143448-wuuuycetc562ty6o) (version source revid:joro@sun.com-20090324135852-b7s2aqvqe2j2oflt) (merge vers: 5.1.34) (pib:6)
[9 Apr 2009 20:10] Paul DuBois
Cosmetic fix only. No changelog entry needed.

Setting report to NDI pending push into 6.0.x.
[13 Apr 2009 9:21] Bugs System
Pushed into 6.0.11-alpha (revid:alik@sun.com-20090413084402-snnrocwzktcl88ny) (version source revid:joro@sun.com-20090324142444-ebqulaq1kxexgmw7) (merge vers: 6.0.11-alpha) (pib:6)
[13 Apr 2009 19:24] Paul DuBois
Cosmetic fix only. No changelog entry needed.
[9 May 2009 16:42] Bugs System
Pushed into 5.1.34-ndb-6.2.18 (revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (version source revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (merge vers: 5.1.34-ndb-6.2.18) (pib:6)
[9 May 2009 17:39] Bugs System
Pushed into 5.1.34-ndb-6.3.25 (revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (version source revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (merge vers: 5.1.34-ndb-6.3.25) (pib:6)
[9 May 2009 18:36] Bugs System
Pushed into 5.1.34-ndb-7.0.6 (revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (version source revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (merge vers: 5.1.34-ndb-7.0.6) (pib:6)