Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning on Unit.c latest revision #177

Closed
RadianFord opened this issue Dec 24, 2014 · 8 comments
Closed

Warning on Unit.c latest revision #177

RadianFord opened this issue Dec 24, 2014 · 8 comments
Labels
status:need user input Issue that needs more information from the issue creator

Comments

@RadianFord
Copy link
Contributor

unit.c: In function ‘unit_can_reach_bl’:
unit.c:2338: warning: array subscript is above array bounds
unit.c:2338: warning: array subscript is above array bounds

Revision '12666'

@Lemongrass3110 Lemongrass3110 added status:need user input Issue that needs more information from the issue creator server:map labels Jan 3, 2015
@Lemongrass3110
Copy link
Member

When does this happen?

@RadianFord
Copy link
Contributor Author

As far as i know this shows on the 12666 revision while compiling.

@Lemongrass3110
Copy link
Member

Which OS? 32/64 bit?
Which tool + version is used for compiling?

@RadianFord
Copy link
Contributor Author

I am using CentOS 6.6 and configure it with 64bit

@Lemongrass3110
Copy link
Member

Could this be somehow related to this?

@cydh
https://rathena.org/board/blog/23/entry-72-issue-for-ur-holidays-o/

@RadianFord
Copy link
Contributor Author

@Lemongrass3110 No its not. the warnings show up on the revision of 12666. i am using an old one right now..

@cydh
Copy link
Contributor

cydh commented Jan 7, 2015

the for when use dirx and diry should use ARRAYLENGTH(dirx) or ARRAYLENGTH(diry)
but somehow the variable for dirx & diry can be wrapped by a struct such

struct s_direction {
    uint8 x, y;
};

//...
//...

struct s_direction dir[] = {
    {0 , 1},
    {-1, 1},
    {-1 , 0},
    {-1 , -1},
    {0 , -1},
    {1 , -1},
    {1 , 0},
    {1 , 1},
};

so the array check in for in unit_can_reach_bl can be ARRAYLENGTH(dir)

@cydh
Copy link
Contributor

cydh commented Jan 7, 2015

errr, too much bullshit I wrote. lol

because the check is i < 9 that means 0 ~ 8 that 8 is out-of-range for the dirx/diry len. 8 len means 0 ~ 7

@cydh cydh closed this as completed in 9021cb6 Jan 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:need user input Issue that needs more information from the issue creator
Projects
None yet
Development

No branches or pull requests

3 participants